#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <cstring>
#include <sstream>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int n,a[20],b[20];
	cin >> n;

	long gg = 1000;

	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i];
	}

	int co = 0;

	for (int i = 0; i < n; i++)
	{
		if (co < b[i])
		{
			co = 0;
			co = b[i];
			gg = 0;
			gg = a[i];
		}
		if (co == b[i])
		{
			if (a[i] < gg)
			{
				gg = 0;
				gg = a[i];
			}
		}
	}

	cout << gg << " " << co << endl;
}


