#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;

  int amin = 0;
  int vmax = -1;
  for (int i = 0; i < n; ++i) {
    int a, v;
    cin >> a >> v;
    if (v < vmax || (v == vmax && amin < a))
      continue;
    amin = a;
    vmax = v;
  }
  cout << amin << " " << vmax << endl;
}
