#include <bits/stdc++.h>
using namespace std;
static const int MAXN = 5e5 + 10;
static const double EPS = 1e-12;
struct P {
  int x, v;
  void input() { scanf("%d%d", &x, &v); }
} p[MAXN];
int n;
bool check(double t) {
  double right = -1e20;
  for (int i = 1; i <= n; i++) {
    if (p[i].v >= 0)
      right = max(right, p[i].x + t * p[i].v);
    else if (right - p[i].x - t * p[i].v > EPS)
      return true;
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) p[i].input();
  double l = 0, r = 1e20;
  for (int i = 0; i < 100; i++) {
    double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (l > 1e10)
    puts("-1");
  else
    printf("%.10lf\n", l);
  return 0;
}
