#include <iostream>

using namespace std;

int main()
{
	int n, a, v, maxa, maxv;

	cin >> n >> maxa >> maxv;

	for (int i=0; i<n-1; i++)
	{
		cin >> a >> v;

		if(v == maxv){
			if(a < maxa){
				maxa = a;
				maxv = v;
			}
		}
		else if(v > maxv){
				maxa = a;
				maxv = v;
		}
	}

	cout << maxa << ' ' << maxv << endl;

	return 0;
}