#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int n;
vector<long long> x, v;
double l = 0, r = 2e9;
bool bigban = false;
bool BB(double t) {
  double M = -1e9;
  bool flag = false;
  for (int i = 0; i < n; i++) {
    double pos = x[i] + v[i] * t;
    if (v[i] > 0) {
      M = max(M, pos);
      flag = true;
    } else {
      if (pos < M && flag == true) {
        return true;
      }
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(12);
  cin >> n;
  x.resize(n);
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> v[i];
  }
  double m;
  for (int i = 0; i < 60; i++) {
    m = (l + r) * 0.5;
    if (BB(m)) {
      r = m;
      bigban = true;
    } else {
      l = m;
    }
  }
  if (bigban) {
    cout << (l + r) * 0.5 << "\n";
  } else {
    cout << -1 << "\n";
  }
  return 0;
}
