#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int n;
	int max[2];
	int a, b;
	cin >> n;
	cin >> max[0] >> max[1];
	for (int i = 1; i < n; i++) {
		cin >> a >> b;
		if (b > max[1]) {
			max[1] = b;
			max[0] = a;
		} else if (b == max[1]) {
			max[0] = min(max[0], a);
		}
	}
	cout << max[0] << " " << max[1] << endl;
	return 0;
}