#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;

	int maxv = -1, maxa = -1;
	for (int i = 0; i < n; i++) {
		int a, v;
		cin >> a >> v;
		if (v > maxv) {
			maxv = v;
			maxa = a;
		}
		else if (v == maxv && a < maxa) {
			maxa = a;
		}
	}

	cout << maxa << " " << maxv << endl;
}