#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,a[1000],max=0;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> m;
		cin >> a[m];
	}
	rep(i,0,n+1){
		if(max<a[i]){
			max=a[i];
		}
	}
	rep(i,0,n+1){
		if(max == a[i]){
			cout << i << " " << a[i] << "\n";
		}
	}
	return 0;
}