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