#include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	cin>>n;
	int num;
	int fish;
	int ansnum;
	int ansfish=-1;
	rep(i,n){
		cin>>num>>fish;
		if(ansfish<fish){
			ansfish=fish;
			ansnum=num;
		}else if(ansfish==fish){
			if(ansnum>num){
				ansfish=fish;
				ansnum=num;
			}
		}
	}
	cout<<ansnum<<" "<<ansfish<<endl;
	return 0;
}