#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
   int n,a,v,ma=999,mv=-1;
   cin >> n;
   for (n;n>0;n--) {
   cin >> a >> v;
   if (mv<=v) { if (mv==v) ma=min(ma,a); else ma=a; mv=v; }
   }
   cout << ma << ' ' << mv << endl;
   return 0;
}