#include <bits/stdc++.h>
using namespace std;
int n, ct;
double x[500001], v[500001], l, r, eps = 1e-12;
int cmp(double x) {
  if (x < eps && x > -eps) return 0;
  return (x < eps ? -1 : 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lf %lf", &x[i], &v[i]);
  r = 1e10;
  while (ct <= 100) {
    int chk = 0;
    double mi = (l + r) / 2, maxPos = -2e18 - 2;
    for (int i = 0; i < n; i++) {
      if (cmp(v[i]) < 0) {
        if (cmp(x[i] + v[i] * mi - maxPos) <= 0) chk = 1;
      } else
        maxPos = max(maxPos, x[i] + v[i] * mi);
    }
    if (chk == 1)
      r = mi;
    else
      l = mi;
    ct++;
  }
  if (cmp(r - 1e9) > 0)
    printf("-1\n");
  else
    printf("%.12lf\n", r);
  return 0;
}
