#include <bits/stdc++.h>
unsigned int n, t, c, to, co, i, m;
int main() {
  scanf("%u", &n);
  for (i = 0; i < n; ++i) {
    scanf("%u%u", &t, &c);
    if (t - to < co) {
      co += c + to - t;
    } else {
      co = c;
    }
    to = t;
    if (m < co) {
      m = co;
    }
  }
  printf("%u %u", t + co, m);
}
