#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int a,b,ma,ans,n;
int main(){
    cin>>n;
    cin>>a>>b;
    ma=b,ans=a;
    for(int i=1;i<n;i++){
        cin>>a>>b;
        if(ma<b){
            ans=a;
            ma=b;
        }else if(ma==b&&ans>a)ans=a;
    }
    cout<<ans<<" "<<ma<<endl;
return 0;
}