#include #include #include const int maxn = 1000006; const int mod = 10007; using namespace std; int main() { int t,n; scanf("%d",&t); while(t--){ double maxx=0,c,b; scanf("%d",&n); while(n--){ scanf("%lf%lf",&b,&c); if((1-c)/(b+1-c)>maxx) maxx=(1-c)/(b+1-c); } printf("%.5lf\n",maxx); } return 0; }