#include <bits/stdc++.h>
const int N = 500000;
struct {
  int x, v;
} A[N];
int n;
bool f(double t) {
  double leftBound = -1e50;
  for (int i = 0; i < n; i++) {
    if (A[i].v > 0) {
      if (leftBound < t * A[i].v + A[i].x) leftBound = t * A[i].v + A[i].x;
    } else if (t * A[i].v + A[i].x < leftBound)
      return true;
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &A[i].x, &A[i].v);
  double l = 0, r = 1e12;
  for (int cnt = 0; cnt < 100; cnt++) {
    double m = (r + l) / 2;
    if (f(m))
      r = m;
    else
      l = m;
  }
  if (l < 1e11)
    printf("%.10lf", l);
  else
    printf("-1");
  return 0;
}
