#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,winner,max=0,a,v;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>a>>v;
        if (v>max) {
            winner=a;
            max=v;
        } else if (v==max) {
            if (a<winner) {
                winner=a;
            }
        }
    }
    cout<<winner<<" "<<max<<endl;
}

