#include <algorithm>
#include <vector>
#include <map>
#include <iostream>

using namespace std;

int main() {
	int n, max = 0;
	cin >> n;
	vector<pair<int, int> > pairs(n);
	for (int i = 0; i < n; i++) {
		int a, v;
		cin >> a >> v;
		pairs[i] = make_pair(a, v);
	}
	sort(pairs.begin(), pairs.end());

	for (int i = 0; i < n; i++) {
		max = pairs[i].second > pairs[max].second? i: max;
	}
	cout << pairs[max].first << ' ' << pairs[max].second << endl;
	return 0;
}