#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,men,fish,num,fishmax;
cin>>n;
for(int i=0;i<n;i++){
cin>>men>>fish;
if(i==0){
num=men;
fishmax=fish;
}
else {
if(fish>fishmax){
fishmax=fish;
num=men;
}
else if(num>men&&fish==fishmax)num=men;
}
}
cout<<num<<" "<<fishmax<<endl;
}