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