#include <iostream>
#include <climits>

int main()
{
	int n;
	int max, argmax;
	int a, v;
	
	std::cin >> n;
	std::cin >> a >> v;
	argmax = a; max = v;
	for (int i=1; i<n; i++) {
		std::cin >> a >> v;
		if (v > max) {
			max = v;
			argmax = a;
		} else if ( v == max && a < argmax ) {
			argmax = a;
		}
	}
	
	std::cout << argmax << " " << max << std::endl;
	
	return 0;
}
