#include<iostream>
#include<map>
using namespace std;

int main() {
	int n;
	map<int, int>m;
	map<int, int>::iterator pm;
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, b;
		cin >> a >> b;
		m.insert(pair<int, int>(b, a));
	}

	pm = m.end();
	pm--;
	cout << pm->second << ' ' << pm->first << endl;
	return 0;

}