#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int n;
int a[110];
int main(void){
	cin >> n;
	rep(i,n){
		int idx,num;
		cin >> idx >> num;
		a[idx-1]=num;
	}
	int ans=max_element(a,a+n)-a;
	cout << ans+1 << " " << a[ans] << endl;
	return 0;
}