#include <bits/stdc++.h>
using namespace std;
const int inf = 2000 * 1000 * 1000;
const double EPS = 1e-9;
double l, r;
int n;
double x[500005];
double v[500005];
bool fun(double t) {
  bool ok = false;
  int i = 0;
  while (v[i] < 0) i++;
  double bar = x[i] + v[i] * t;
  for (i; i < n; i++) {
    if (v[i] > 0)
      bar = max(bar, x[i] + v[i] * t);
    else if (bar >= x[i] + v[i] * t)
      return true;
  }
  return false;
}
int main() {
  int i;
  cin >> n;
  for (i = 0; i < n; i++) cin >> x[i] >> v[i];
  l = 0;
  r = 1 << 30;
  for (i = 0; i < 100; i++) {
    double m = (l + r) / 2;
    if (fun(m))
      r = m;
    else
      l = m;
  }
  if (fun(r))
    printf("%.9lf\n", r);
  else
    printf("-1\n");
  return 0;
}
