#include<iostream>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int n;
  cin >> n;
  int ra = 1000, rb = -1;
  rep (i, n) {
    int a, b;
    cin >> a >> b;
    if (rb < b || (rb == b && ra > a)) {
      ra = a;
      rb = b;
    }
  }
  cout << ra << " " << rb << endl;
  return 0;
}