#include using namespace std; #define Int register int #define MAXN 105 template inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;} template inline void read (T &t,Args&... args){read (t);read (args...);} template inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');} int n; signed main(){ int t;read (t); while (t --){ read (n);double maxn = 0,a,c; for (Int i = 1;i <= n;++ i) scanf ("%lf%lf",&a,&c),maxn = max (maxn,(1 - c) / (a + 1 - c)); printf ("%.5f\n",maxn); } return 0; }