#include<iostream>
using namespace std;

int main(void) {
	int n, max_player,a,b,max=-1;
	cin >> n;
	while (n) {
		cin >> a >> b;
		if (b > max) {
			max_player = a;
			max = b;
		}
		else if (b == max) {
			if (max_player > a)max_player = a;
		}
		n--;
	}
	cout << max_player << " " << max << endl;

}