#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5e5 + 5;
const double eps = 1e-11;
struct PARTICLES {
  int x, v;
} par[MAX_N];
int n;
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &par[i].x, &par[i].v);
}
bool collision(double t) {
  double right = -1e30;
  for (int i = 0; i < n; i++) {
    double tmp = (double)par[i].x + t * (double)par[i].v;
    if (par[i].v > 0) {
      if (tmp > right) right = tmp;
    } else {
      if (tmp <= right) return 1;
    }
  }
  return 0;
}
void solve() {
  double l = 0.0, r = 1e10;
  for (int i = 0; i < 120; i++) {
    double mid = (l + r) / 2.0;
    if (collision(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == 1e10)
    printf("-1\n");
  else
    printf("%.13f\n", l);
}
int main() {
  input();
  solve();
  return 0;
}
