#include<iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[30]={0};
    for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        a[x] = y;
    }
    int m =0 ,M = 1;
    for(int i = 1;i <= n;i++)if(m < a[i])M = i,m = a[i];
    cout<<M<<" "<<m<<endl;
    return 0;
}