#include <iostream>

using namespace std;

int main(){
  int a,b,n;
  int x[2]={21,0};
  cin>>n;
  while(n--){
    cin>>a>>b;
    if(x[1]<=b){
      x[0]=(x[1]==b)?(x[0]>a)?a:x[0]:a;x[1]=b;
    }
  }
  cout<<x[0]<<' '<<x[1]<<endl;
  return 0;
}