#include #include #include #include #include #include using namespace std; template inline void R(Type &x) { int c = getchar(); bool neg = 0; for (; c < 48 || c > 57; c = getchar())if (c == '-')neg = true; for (x = 0; c > 47 && c < 58; x = (Type) 10 * x + c - 48, c = getchar()); if (neg)x = -x; } int n; double perc; int main() { int T; R(T); while (T--) { R(n); perc = 0.0; for (int i = 1; i <= n; ++i) { double b, c; scanf("%lf%lf", &b, &c); perc = max(perc, (1 - c) / (b + 1 - c)); } printf("%.5lf\n",perc); } return 0; }