#include<iostream>
#include<algorithm>
using namespace std;
int a[1000000], b[1000000], maxid, maxn, n;
int main() {
	cin >> n; maxn = 0; maxid = 100000;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		if (maxn < b[i]) {
			maxn = b[i];
			maxid = a[i];
		}
		else if (maxn == b[i]) {
			maxid = min(maxid, a[i]);
		}
	}
	cout << maxid << ' ' << maxn << endl;
}