#include<stdio.h>
 
int main(){
	int n, a, b, i, max = 0, num;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		if(max <= b){
			max = b;
			if(max < b) num = a;
			else if(num > a) num = a; 
		}
	}
	printf("%d %d\n", num, max);
	return 0;
}