#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
long long n, x[maxn], v[maxn];
bool check(long double t) {
  long double mx = -1e100;
  for (int i = 0; i < n; i++) {
    if (v[i] > 0) {
      mx = max(mx, x[i] + v[i] * t);
    } else {
      if (mx >= x[i] + v[i] * t) {
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> v[i];
  long double l = 0, r = 1e15;
  int s = 100;
  while (s--) {
    long double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  if (!check(r)) {
    cout << fixed << setprecision(10) << -1.0000000000;
    return 0;
  }
  cout << fixed << setprecision(10) << r;
  return 0;
}
