#include <iostream>
using namespace std;

int main()
{
	int n;
	while( cin >> n ){
		int ansA, ansV;
		ansA = 100, ansV = 0;
		for( int i = 0; i < n; ++i ){
			int a, v;
			cin >> a >> v;
			if( ansV < v ){
				ansA = a;
				ansV = v;
			}else if( ansV == v && ansA > a ){
				ansA = a;
			}
		}
		cout << ansA << " " << ansV << endl;
	}

	return 0;
}