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