#include <bits/stdc++.h>
using namespace std;
int n;
long long le, ri, maxn;
int t[100005], c[100005];
inline int read() {
  register char c = 0;
  register int X = 0;
  while (!isdigit(c = getchar()))
    ;
  while (isdigit(c)) X = (X << 3) + (X << 1) + (c ^ 48), c = getchar();
  return X;
}
int main() {
  n = read(), t[1] = read(), c[1] = read();
  le = t[1], ri = t[1] + c[1], maxn = c[1];
  for (register int i = 2; i <= n; ++i) {
    t[i] = read(), c[i] = read();
    if (t[i] > ri)
      ri = t[i] + c[i];
    else
      ri += c[i];
    le = t[i], maxn = max(maxn, ri - le);
    if (le > ri) le = ri;
  }
  cout << ri << " " << maxn;
  return 0;
}
