#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;


struct fish{
    int man;
    int point;
};


bool comp(const fish f1, const fish f2){
    if(f1.point<f2.point){
        return 0;
    }else if(f1.point>f2.point){
        return 1;
    }else{
        if(f1.man<f2.man){
            return 1;
        }else if(f1.man>f2.man){
            return 0;
        }else{
            return 0;
        }
    }
}

int main(){
    int n;
    while(cin>>n){
        fish f[20];
        for(int i=0; i<n; i++){
            cin>>f[i].man>>f[i].point;
        }
        
        sort(f, f+n, comp);
        
        
        
        cout<<f[0].man<<" "<<f[0].point<<endl;
        
        
       
    }
}