#include <bits/stdc++.h>
using namespace std;
int n;
struct particle {
  int x, v;
} particles[500002];
bool possible(long double time) {
  long double maxRightyX = -1e19;
  for (int i = 1; i <= n; i++) {
    if (particles[i].v > 0) {
      maxRightyX = max(particles[i].x + particles[i].v * time, maxRightyX);
    } else if (maxRightyX >= particles[i].x + particles[i].v * time) {
      return true;
    }
  }
  return false;
}
void bin() {
  long double l = 0, r = 1000000000;
  while (l + 0.0000000001 < r) {
    long double mid = (l + r) / 2;
    if (possible(mid))
      r = mid;
    else
      l = mid + 0.0000000001;
  }
  cout << fixed << setprecision(10);
  if (possible(l)) {
    cout << l;
  } else if (possible(r)) {
    cout << r;
  } else {
    cout << "-1";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> particles[i].x >> particles[i].v;
  bin();
  return 0;
}
