#include <iostream>
#include <string>
using namespace std;

int main(){
	int n, a, v, maxa, maxv;
	while (cin >> n) {
		int maxa = 21, maxv = 0;
		for (int i = 0; i < n; i++) {
			cin >> a >> v;
			if (v > maxv) {
				maxv = v;
				maxa = a;
			}
			else if(v == maxv && maxa > a){
				maxa = a;
			}
		}
		cout << maxa << " " << maxv << endl;
	}
	return 0;
}