#include<iostream>

using namespace std;

int main()
{
	int n, max = 0, num, i, a;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a >> a;
		if (a > max)
		{
			max = a;
			num = i + 1;
		}
	}
	cout << num << " " << max << endl;
    return 0;
}