#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	int n,a[25],v[25],b[25];
	int j[25]={};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
		b[a[i]-1]=v[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++){
		if(v[i]==b[n-1]){
			j[a[i]]++;
		}
	}
	for(int i=1;i<=n;i++){
		if(j[i]!=0){
			cout<<i<<" "<<b[n-1]<<endl;
			return 0;
		}
	}
}