#include<cstdio>
using namespace std;
int min(int a,int b){return(a < b)?a:b;}
int main(){
	int n;
	scanf("%d",&n);
	int num = 99999,fish = 0;
	for(int i = 0; i < n; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		if(fish <= y){
			if(fish == y)num = min(num,x);
			else num = x;
			fish = y;
		}
	}
	printf("%d %d\n",num,fish);
	return 0;
}