#include <bits/stdc++.h>
using namespace std;
const long long maxN = 500 * 1000 + 2;
const long long mod = 1000 * 1000 * 1000 + 7;
double x[maxN], v[maxN];
int n;
bool check(double t) {
  double mx = -mod * mod;
  mx *= 100;
  for (int i = 0; i < n; i++) {
    double ps = x[i] + v[i] * t;
    if (v[i] < 0) {
      if (mx + 1e-23 >= ps) return true;
    } else
      mx = max(mx, ps);
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf", &x[i], &v[i]);
  }
  double lo = 0, hi = mod * 2 + 5;
  for (int z = 0; z < 100; z++) {
    double mid = (hi + lo) / 2;
    if (check(mid))
      hi = mid;
    else
      lo = mid;
  }
  if (hi > mod * 2) {
    cout << -1 << endl;
    return 0;
  }
  printf("%.10lf\n", hi);
  return 0;
}
