#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
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,mm=-1;
    for(int i=1;i<=n;i++){
        if(m<a[i]){
            mm = i;
            m = a[i];
        }


    }
    cout<<mm<<" "<<m<<endl;


    return 0;
}