#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;

int main(void){
	int n,m[1000],a[1000],max=0,num;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> m[i];
		cin >> a[m[i]];
	}
	for(int i=0;i<n;i++){
		if(max<a[m[i]]){
			max = a[m[i]];
			num = m[i];
		}
		if( (max==a[m[i]])&&(num<m[i]) ){
			max = a[m[i]];
			num = m[i];
		}
	}
	cout << num << " " << max << "\n";
	return 0;
}