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