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

int main() {
	int n;
	int x[20];
	int y[20] = {};
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, v;
		cin >> a >> v;
		x[a - 1] = v;
		y[a - 1] = x[a - 1];
	}
	sort(y, y + 20);
	for (int i = 0;i < 20;i++) {
		if (y[19] == x[i]) {
			cout << (i + 1) << ' ' << x[i] << endl;
		}
	}
	return 0;
}