#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-12;
const int maxn = 5e5 + 10;
struct point {
  double x, v;
  point() {}
  point(double xx, double vv) {
    x = xx;
    v = vv;
  }
} l[maxn], r[maxn];
int ltot = 0, rtot = 0;
bool check(double t) {
  int id = ltot - 1;
  double mn = 1e16;
  for (int i = rtot - 1; i >= 0; i--) {
    while (id >= 0 && l[id].x - r[i].x >= eps) {
      mn = min(mn, l[id].x + l[id].v * t);
      id--;
    }
    if (r[i].x + r[i].v * t - mn >= eps) return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x, v;
    scanf("%lf%lf", &x, &v);
    if (v > 0)
      r[rtot++] = point(x, v);
    else
      l[ltot++] = point(x, v);
  }
  if (ltot == 0 || rtot == 0 || r[0].x - l[ltot - 1].x >= eps) {
    printf("-1\n");
    return 0;
  }
  double left = 0, right = 1e9, mid;
  for (int i = 0; i < 60; i++) {
    mid = (left + right) / 2.0;
    if (check(mid))
      right = mid;
    else
      left = mid + eps;
  }
  printf("%.12lf\n", left);
  return 0;
}
