#include <iostream>
using namespace std;

int main(){
  int n;

  while(cin >> n){
    int minA, maxV = -1;

    for(int i = 0; i < n; i++){
      int a, v;
      cin >> a >> v;

      if(maxV < v || maxV == v && minA > a){
        minA = a;
        maxV = v;
      }
    }

    cout << minA << " " << maxV << endl;
  }
}