#include<iostream>
using namespace std;

int main(){

	int n;
	int fish[20];
	int ans1 = 0;
	int ans2;
	int num;

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> num;
		cin >> fish[num - 1];
	}

	for (int i = 0; i < n; i++){
		if (fish[i] > ans1){
			ans1 = fish[i];
			ans2 = i + 1;
		}
	}

	cout << ans2 << " " << ans1 << endl;

	return 0;
}