#include <iostream>
using namespace std;
int main(void){
	int n,a[21],v[21],max=0,num=21;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i]>>v[i];
		if(v[i]>=max){
			if(max!=v[i]) num=a[i];
			else if(num>a[i]) num=a[i];
			max=v[i];
		}
	}
	cout<<num<<" "<<max<<endl;
	return 0;
}