#include using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define rep(i, a, b) for(int i = (a); i < (b); i++) #define per(i, a, b) for(int i = (b) - 1; i >= (a); --i) #define de(x) cout << #x << " = " << x << endl #define dd(x) cout << #x << " = " << x << " " #define endl '\n' #define pw(x) (1ll<<(x)) #define all(x) x.begin(), x.end() #define sz(x) (int)x. size() typedef long long ll; typedef double db; typedef pair pii; typedef vector vi; int t; int n; double b,c; int main() { std::ios::sync_with_stdio(0); std::cin.tie(0); while(cin>>t) { while(t--) { cin>>n; double ans=0; rep(i,1,n+1) { cin>>b>>c; ans=max(ans,(1-c)/(b+(1-c))); } printf("%.5lf\n",ans); } } return 0; }