#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a[101];
  int max=0;
  for(int i=0; i<n; i++) {
    int x,y;
    cin >> x >> y;
    a[y].push_back(x);
    if(max<y) max=y;
  }
  sort(a[max].begin(),a[max].end());
  cout << a[max][0] << " " << max << endl;
  return 0;
}
