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


int main()
{
	int ary[21] = {};
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		ary[a] = b;
	}
	int *p = max_element(ary + 1, ary + n + 1);
	cout << p - ary << ' ' << *p << endl;

	return 0;
}