#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	int num = 0;
	int fish = -1;
	for (int i = 0; i < n; ++i) {
		int a, v;
		cin >> a >> v;
		if (fish < v) {
			num = a;
			fish = v;
		}
		else if (fish == v && num > a) {
			num = a;
		}
	}
	cout << num << ' ' << fish << endl;
	
	return 0;
}