#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int n;
	
	cin >> n;
	pair<int, int> av[n];
	
	REP(n)
	{
		cin >> av[i].first >> av[i].second;
	}
	
	int max_num = -1;
	int ind;
	REP(n)
	{
		if (av[i].second > max_num)
		{
			max_num = av[i].second;
			ind = av[i].first;
		} else if (av[i].second == max_num && ind > av[i].first) {
			max_num = av[i].second;
			ind = av[i].first;
		}
	}
	
	cout << ind << " " << max_num << endl;
	
	return 0;
}