#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>

#define int64 long long int
using namespace std;

typedef pair<int, int> P;

class Hoge {
public:
	int a, v;
	Hoge(int a, int v){
		Hoge::a = a, Hoge::v = v;
	}
	Hoge(){}
};

class LS
{
public:
	bool operator() (Hoge h1, Hoge h2){
		if(h1.v == h2.v) return (h1.a > h2.a) ? true : false;
		else return (h1.v < h2.v) ? true : false;
	}
};

int main()
{
	int n, a, v;
	Hoge *hoge;

	cin >> n;

	hoge = new Hoge[n];

	for(int i=0; i<n; i++){
		cin >> a >> v;
		hoge[i].a = a, hoge[i].v = v;
	}

	priority_queue<Hoge, vector<Hoge>, LS> qu;

	for(int i=0; i<n; i++) qu.push(hoge[i]);

	cout << (qu.top()).a << ' ' << (qu.top()).v << endl;

	delete [] hoge;

	return 0;
}