#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    ll n;
	cin>>n;
	ll a[n],b[n];
	vector<pair<ll, ll> > ab(n);
	for(ll i=0;i<n;i++)cin>>a[i]>>b[i];
	for(int i=0;i<n;i++){
		ab[i] = make_pair(b[i],a[i]);
	}
	sort(ab.begin(),ab.end());
	int mi=101;
	for(int i=0;i<n;i++){
	    if(ab[i].first==ab[n-1].first){
	        if(mi>ab[i].second)mi=ab[i].second;
	    }
	}
	cout<<mi<<" "<<ab[n-1].first<<endl;
}

