#include <bits/stdc++.h>

using namespace std;

const int N = 20;

int main() {
	int n, m = 0;
	int a[N + 1] = { 0 };
	int x, y;
	cin >> n;
	for(int i = 0;i < n;++i) {
		cin >> x >> y;
		a[x] = y;
		m = y > m ? y : m;
	}
	for(int i = 1;i <= N;++i) {
		if(a[i] == m) {
			cout << i << " " << a[i] << endl;
			break;
		}
	}
	return 0;
}

