#include <iostream>
using namespace std;

int main(){
	int n, A, V;
	cin >> n;
	for(int i = 0; i < n; i++){
		int a, v;
		cin >> a >> v;
		if( i == 0 ){
			A = a; V = v;
		}else{
			if( V < v || ( V == v && a < A) ){
				V = v; A = a;
			}
		}
	}
	cout << A << " " << V << endl;
}