#include <iostream>
#include <vector>

typedef pair<int, int> P;

using namespace std;

void solve(vector<P> v) {
	int minID, maxNum;
	minID = v[0].first();
	maxNum = v[0].second();
	for (int i = 1; i < v.size(); i++) 
		if (v[i].second > maxNum || (v[i].second == maxNum && v[i].first < minID)) {
			minID = v[i].first();
			maxNum = v[i].second();
		}

	cout << minID << " " << maxNum << endl;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, a, v;
	cin >> n;
	vector<P> fish;
	for (int i = 0; i < n; i++) {
		cin >> a >> v;
		fish.push_back(P(a, v));
	}
	solve(fish);
}