#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int N,x,y,ans1,ans2=-1;
	vector <int> num;
	cin >> N;
	while(N--){
		cin >> x >> y;
		if(y>ans2){
			num.clear();
			num.push_back(x);
			ans2 = y;
		}
		else if(y==ans2){
			num.push_back(x);
		}
	}
	sort(num.begin(),num.end());
	cout << num[0] << ' ' << ans2 << endl;
	return 0;
}
