#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void *wmem;
char memarr[96000000];
template <class T>
inline void walloc1d(T **arr, int x, void **mem = &wmem) {
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void *)(((char *)(*mem)) + skip[((unsigned long long)(*mem)) & 15]);
  (*arr) = (T *)(*mem);
  (*mem) = ((*arr) + x);
}
template <class T1, class T2>
void sortA_L(int N, T1 a[], T2 b[], void *mem = wmem) {
  int i;
  pair<T1, T2> *arr;
  walloc1d(&arr, N, &mem);
  for (i = (0); i < (N); i++) {
    arr[i].first = a[i];
    arr[i].second = b[i];
  }
  sort(arr, arr + N);
  for (i = (0); i < (N); i++) {
    a[i] = arr[i].first;
    b[i] = arr[i].second;
  }
}
template <class T1, class T2, class T3>
void sortA_L(int N, T1 a[], T2 b[], T3 c[], void *mem = wmem) {
  int i;
  pair<T1, pair<T2, T3> > *arr;
  walloc1d(&arr, N, &mem);
  for (i = (0); i < (N); i++) {
    arr[i].first = a[i];
    arr[i].second.first = b[i];
    arr[i].second.second = c[i];
  }
  sort(arr, arr + N);
  for (i = (0); i < (N); i++) {
    a[i] = arr[i].first;
    b[i] = arr[i].second.first;
    c[i] = arr[i].second.second;
  }
}
inline void rd(int &x) {
  int k;
  int m = 0;
  x = 0;
  for (;;) {
    k = getchar_unlocked();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    k = getchar_unlocked();
    if (k < '0' || k > '9') {
      break;
    }
    x = x * 10 + k - '0';
  }
  if (m) {
    x = -x;
  }
}
inline void rd(long long &x) {
  int k;
  int m = 0;
  x = 0;
  for (;;) {
    k = getchar_unlocked();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    k = getchar_unlocked();
    if (k < '0' || k > '9') {
      break;
    }
    x = x * 10 + k - '0';
  }
  if (m) {
    x = -x;
  }
}
inline void wt_L(char a) { putchar_unlocked(a); }
inline void wt_L(long long x) {
  int s = 0;
  int m = 0;
  char f[20];
  if (x < 0) {
    m = 1;
    x = -x;
  }
  while (x) {
    f[s++] = x % 10;
    x /= 10;
  }
  if (!s) {
    f[s++] = 0;
  }
  if (m) {
    putchar_unlocked('-');
  }
  while (s--) {
    putchar_unlocked(f[s] + '0');
  }
}
template <class T>
inline T GCD_L(T a, T b) {
  T r;
  while (a) {
    r = b;
    b = a;
    a = r % a;
  }
  return b;
}
template <class T>
struct Heap_max {
  int size;
  T *val;
  void malloc(const int N) {
    val = (T *)std::malloc(N * sizeof(T));
    size = 0;
  }
  void walloc(const int N, void **mem = &wmem) {
    walloc1d(&val, N, mem);
    size = 0;
  }
  void free() { std::free(val); }
  void init() { size = 0; }
  void up() {
    int n = size - 1;
    int m;
    while (n) {
      m = (n - 1) / 2;
      if (val[m] >= val[n]) {
        break;
      }
      swap(val[m], val[n]);
      n = m;
    }
  }
  void down() {
    int n = 0;
    int m;
    for (;;) {
      m = 2 * n + 1;
      if (m >= size) {
        break;
      }
      if (m + 1 < size && val[m] < val[m + 1]) {
        m++;
      }
      if (val[m] <= val[n]) {
        break;
      }
      swap(val[m], val[n]);
      n = m;
    }
  }
  T top() { return val[0]; }
  T pop() {
    T res = val[0];
    size--;
    if (size > 0) {
      val[0] = val[size];
      down();
    }
    return res;
  }
  T push(const T x) {
    val[size++] = x;
    up();
    return x;
  }
};
int N;
long long A[100000];
long long B[100000];
long long val[100000];
long long arr[100000];
double vald[100000];
long long res1;
long long res2;
void update(long long a, long long b) {
  double d1;
  double d2;
  long long g;
  g = GCD_L(a, b);
  a /= g;
  b /= g;
  d1 = (double)a / b;
  d2 = (double)res1 / res2;
  if (d1 > d2) {
    res1 = a;
    res2 = b;
  }
}
int main() {
  int loop;
  wmem = memarr;
  long long up;
  long long dw;
  long long tm;
  long long tot;
  Heap_max<long long> done;
  Heap_max<long long> yet;
  rd(N);
  {
    int KL2GvlyY;
    for (KL2GvlyY = (0); KL2GvlyY < (N); KL2GvlyY++) {
      rd(A[KL2GvlyY]);
      rd(B[KL2GvlyY]);
    }
  }
  res1 = 0;
  res2 = 1;
  done.malloc(N);
  yet.malloc(N);
  for (loop = (0); loop < (11); loop++) {
    int x;
    done.init();
    yet.init();
    if (loop == 0) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = A[i] - B[i];
      }
    }
    if (loop == 1) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = B[i] - A[i];
      }
    }
    if (loop == 2) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = A[i] + B[i];
      }
    }
    if (loop == 3) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = 1.0 / A[i] - 1.0 / B[i];
      }
    }
    if (loop == 4) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = 1.0 / B[i] - 1.0 / A[i];
      }
    }
    if (loop == 5) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = (double)A[i] / B[i];
      }
    }
    if (loop == 6) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = (double)B[i] / A[i];
      }
    }
    if (loop == 7) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = A[i];
      }
    }
    if (loop == 8) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = -A[i];
      }
    }
    if (loop == 9) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = B[i];
      }
    }
    if (loop == 10) {
      int i;
      for (i = (0); i < (N); i++) {
        vald[i] = -B[i];
      }
    }
    sortA_L(N, vald, A, B);
    tm = 0;
    for (x = (1); x < (N + 1); x++) {
      tm += A[x - 1];
      yet.push(B[x - 1]);
      while (yet.size && done.size && done.top() < yet.top()) {
        up = done.pop();
        dw = yet.pop();
        tm += up - dw;
        done.push(dw);
        yet.push(up);
      }
      while (done.size && tm <= 0) {
        tm += yet.push(done.pop());
      }
      while (yet.size && tm > yet.top()) {
        tm -= done.push(yet.pop());
      }
      if (yet.size == 0) {
        continue;
      }
      up = (yet.top() - tm) + (yet.size - 1) * yet.top();
      dw = yet.top() * N;
      update(up, dw);
    }
  }
  wt_L(res1);
  wt_L(' ');
  wt_L(res2);
  wt_L('\n');
  return 0;
}
