#include <cstdio>
using namespace std;

int main() {
  int n, a, b, max_a, max_b;
  scanf("%d", &n);
  max_a = max_b = -1;
  for (int i=0; i<n; i++) {
    scanf("%d %d", &a, &b);
    if (max_b<b) {
      max_b = b;
      max_a = a;
    } else if (max_b==b && max_a>a) {
      max_a = a;
    }
  }
  printf("%d %d\n", max_a, max_b);
  return 0;
}