#include <iostream>
using namespace std;

int main(){
	int n,max=-1,num=-1,a[20],v[20];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
		if(max<v[i] && max!=v[i]){
			num=a[i];
			max=v[i];
		}else if(max==v[i] && num>a[i]){
			num=a[i];	
		}
	}
	cout<<num+1<<" "<<max<<endl;

		return 0;
}