#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	
	int n, dummy1, dummy2, max, ans;
	
	int v[1000];
	
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		v[i] = 0;
	}
	
	for(int i = 1; i <= n; i++){
		cin >> dummy1 >> dummy2;
		v[dummy1] = dummy2;
	}
	
	max = 0;
	
	for(int i = n; i > 0; i--){
		if(v[i] >= max){
			ans = i;
			max = v[i];
		}
	}
	
	printf("%d %d\n", ans, v[ans]);
	
	return 0;
}