#include <iostream>

using namespace std;

int main(){

	int n;
	int ary[101] , v[101];

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> ary[i];
		cin >> v[i];
	}

	for(int i = 0; i < n; i++){
		for(int j = 1; j < n-1; j++){
			if(v[i] < v[j]){
				int tmp = v[i];
				v[i] = v[j];
				v[j] = tmp;

				int tmpn = ary[i];
				ary[i] = ary[j];
				ary[j] = tmpn;
			}
		}
	}
	
	cout << ary[n-1] << " " << v[n-1] << endl;

	return 0;
}