#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

bool comb(pair<int,int> a,pair<int,int> b){
    if(a.first==b.first){
        return a.second>b.second;
    }else return a>b;
}

int main(){
    int n;cin>>n;
    vector<pair<int,int>> v(n);
    
    rep(i,0,n){
        cin>>v[i].se>>v[i].fi;
    }
    rep(i,0,n-1){
        rep(j,i+1,n){
            if(v[i].fi>v[j].fi){
                pair<int,int> temp;
                temp=v[i];
                v[i]=v[j];
                v[j]=temp;
            }else if(v[i].fi==v[j].fi){
                if(v[i].se>v[i].se){
                    pair<int,int> temp;
                    temp=v[i];
                    v[i]=v[j];
                    v[j]=temp;
                }
            }
        }
    }
    cout<<v[n-1].se<<" "<<v[n-1].fi<<endl;

    return 0;
}

