#include<cstdio>

int n;
int a[21],v[21];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d",&a[i],&v[i]);
	int mid=a[0],m=v[0];
	for(int i=1;i<n;i++){
		if(m<v[i]){
			mid=a[i];
			m=v[i];
		}
		if(m==v[i] && mid>a[i])mid=a[i];
	}
	printf("%d %d\n",mid,m);
	return 0;
}