#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <functional>

#define n_fish first
#define number second

using namespace std;

typedef pair<int, int> PAIR;

struct CompEntrants{
  bool operator()(const PAIR &entrant1, const PAIR &entrant2) const
  {
    if(entrant1.n_fish == entrant2.n_fish)
      return entrant1.number < entrant2.number;
    return entrant1.n_fish > entrant2.n_fish;
  }
};

int main()
{
  int n_entrants;
  vector<PAIR> entrants;
  PAIR entrant;

  cin >> n_entrants;
  for(int i = 0; i < n_entrants; ++i){
    cin >> entrant.number >> entrant.n_fish;
    entrants.push_back(entrant);
  }
  sort(entrants.begin(), entrants.end(), CompEntrants());

  cout << entrants.front().number << " " << entrants.front().n_fish << endl;

  return 0;
}