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

bool great(const pair<int, int>& l, const pair<int, int>& r) {
	if (l.second == r.second) return l.first < r.first;
	else return l.second > r.second;
}

int main(){
	int n,a,b;
	vector<pair<int, int> > v;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}
	sort(v.begin(), v.end(), great);
	cout << v[0].first << " " << v[0].second << endl;
	return 0;
}