#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int n,a[20],b[20],k;
	while(cin >> n){
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
	}
	for(int j=1;j<n;j++){
		for(int i=0;i<n-j;i++){
			if(b[i]<b[i+1]){
				k=b[i];b[i]=b[i+1];b[i+1]=k;
				k=a[i];a[i]=a[i+1];a[i+1]=k;
			}
		}
	}
	cout << a[0] <<" "<< b[0] <<"\n";
	}
return 0;
}