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

int main() 
{
	map<int, int>s;
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d;
		cin >> c >> d;
		s.insert (pair<int, int>(d, c));
	}
	auto e = s.end();
	e--;
	cout << e->second << " " << e->first << endl;
}