#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int n;
	cin >> n;
	

	int t[20][2];
	vector<int> res;
	rep(i,n)
	{
		int a,v;
		cin >> a >> v;
		t[i][0] = a;
		t[i][1] = v;
		res.push_back(v);
	}

	sort(res.begin(),res.end(),greater<int>());

	rep(i,n)
	{
		if(t[i][1] == res[0])
		{
			cout << t[i][0] << " " << res[0] << endl;
			return 0;
		}
	}
	return 0;
}