#include<iostream>
using namespace std;
int main(){
long n,i,a,b,aa,bb=0;
cin>>n;
for(i=0;i<n;i++){
cin>>a>>b;
if(bb<b){aa=a;bb=b;}
else if(bb==b&&a<aa){aa=a;bb=b;}
}
cout<<aa<<" "<<bb<<endl;
return 0;
}