#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;

int main() {
	int n;
	cin >> n;
	int fish[n+1];
	rep(i,n) {
		int a, v;
		cin >> a >> v;
		fish[a] = v;
	}
	int mi = 1;
	for(int i=2; i<=n; i++) {
		if(fish[mi] < fish[i]) mi = i;
	}
	cout << mi << ' ' << fish[mi] << endl;
	return 0;
}