#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector< pair<int,int> > res;
	rep(i,n)
	{
		int a,v;
		cin >> a >> v;
		res.push_back(pair<int,int>(v,a));
	}

	sort(res.begin(),res.end(),greater<pair<int,int> >());
	int min_num = 21;
	rep(i,n)
	{
		if(res[0].first == res[i].first)
		{
			min_num = min(min_num,res[i].second);
		}
	}

	cout << min_num << " " << res[0].first << endl;
	return 0;
}