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

using namespace std;

int main(void)
{
	int n;
	int a, v;
	vector < pair <int, int> > vi;

	cin >> n;
	while (n--){
		cin >> a >> v;
		vi.push_back(make_pair(v, a));
	}
	sort(vi.rbegin(), vi.rend());

	int ret[2] = {0}, ma = vi[0].first;
	for (int i = 0; i < vi.size(); i++){
		if (ma == vi[i].first){
			ret[0] = vi[i].first;
			ret[1] = vi[i].second;
		}
		else {
			break;
		}
	}


	cout << ret[1] << " " << ret[0] << endl;

	return 0;
}