#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <iostream>

using namespace std;
/** Problem0095 : Surf Fishing Contest **/
int main()
{
	map<int, vector<int> > list;
	int n, a, v, maxV=0;
	
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> a >> v;
		list[v].push_back(a);
		maxV = max(v, maxV);
	}
	
	vector<int> vec = list[maxV];
	sort(vec.begin(), vec.end());
	cout << vec[0] << " " << maxV << endl;
	return 0;
}