#include<iostream>
#include<map>
#include<utility>
#include<vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<pair<int ,int> > a(n);

  for(int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }

  int max = -1;
  int min_num = 9999;
  for(int i = 0; i < n; i++) {
    if(max < a[i].second) {
      max = a[i].second;
    }
  }

  for(int i = 0; i < n; i++) {
    if(max == a[i].second && min_num > a[i].first) {
      min_num = a[i].first;
    }
  }

  cout << min_num << " " << max << endl;

  return 0;
}