#include<iostream>
using namespace std;

int main(){
  int a,b,c,max=0,maxh;;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>b>>c;
    if(c>max){
      max=c;
      maxh=b;
    }else if(max==c&&maxh>b){
      max=c;
      maxh=b;
    }
  }
  cout<<maxh<<" "<<max<<endl;
  return 0;
}