#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef pair<int, int> p;

void solve()
{
	int n;
	cin >> n;
	vector<p> list(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> list[i].second >> list[i].first;
	}
	sort(list.begin(), list.end());
	int max_point = list[n - 1].first;
	int min_num = 99999;
	for(int i = 0; i < n; ++i)
	{
		if(max_point == list[i].first)
		{
			if(min_num > list[i].second)
			{
				min_num = list[i].second;
			}
		}
	}
	cout << min_num << " " << max_point << endl;
}

int main()
{
	solve();
	return(0);
}