#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	int n;
	cin >> n;
	int m[n+1];
	vector<int> vec;
	for(int i=0;i<n;i++)
	{
		int s;
		cin >> s;
		cin >> m[s];
		vec.pb(m[s]);
	}
	sort(vec.begin(),vec.end(),greater<int>());
	int t = vec[0];
	int b;
	for(int i=1;i<n+1;i++)
	{
		if(m[i]==t)
		{
			b=i;
			break;
		}
	}
	cout << b << ' ' << m[b] << endl;
	return 0;
}