#include <bits/stdc++.h>
using namespace std;
int n;
struct Node {
  double pos, v;
};
struct Node node[500010];
double aabs(double x) {
  if (x > 0) return x;
  return -x;
}
int find(double t) {
  double now;
  int index = 1;
  while (node[index].v < 0) index++;
  now = node[index].pos + node[index].v * t;
  for (int i = index + 1; i <= n; i++) {
    if (node[i].v > 0)
      now = max(node[i].pos + node[i].v * t, now);
    else {
      double test = node[i].pos + node[i].v * t;
      if (test <= now) return 1;
    }
  }
  return 0;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    int a = 0, b = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%lf %lf", &node[i].pos, &node[i].v);
      if (node[i].v < 0)
        a++;
      else
        b++;
    }
    if (a == 0 || b == 0) {
      printf("-1\n");
      continue;
    }
    double left = 0.0, right = 2000000000.0;
    int found = 0;
    while (aabs(left - right) > 1e-9 * right) {
      double mid = (left + right) / 2.0;
      int test = find(mid);
      if (test == 1) {
        found = 1;
        right = mid;
      } else
        left = mid;
    }
    if (found == 0)
      printf("-1\n");
    else
      printf("%.12lf\n", left);
  }
  return 0;
}
