#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n) {
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
      int a, v;
      cin >> a >> v;
      d[a - 1] = v;
    }
    int id = 0;
    for (int i = 0; i < n; i++) {
      if (d[i] > d[id]) id = i;
    }
    cout << id + 1 << " " << d[id] << endl;
  }

  return 0;
}
