#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;

int main(){
	int n;
	int person[22], fish[22];
	int array[22];
	int fisherMan[22];
	int fisher = 0;

	cin >> n;
	for(int i=0; i < n; i++){
		cin >> person[i] >> fish[i];
		array[i] = fish[i];
	}
	sort(array, array+n, greater<int>());

	for(int i=0; i < n; i++){
		if(fish[i] == array[0]){
			fisherMan[fisher] = person[i];
			fisher++;
		}
	}

	sort(fisherMan, fisherMan+fisher);

	cout << fisherMan[0] << " "  << array[0] << endl;
}