
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Name;

bool menor(vector<Name>::iterator it1, 
           vector<Name>::iterator it2);

int main() {
   Name N;
   vector<Name> v;
   while (cin >> N.first >> N.last) {
      v.push_back(N);
   }
   vector<Name>::iterator mn = v.begin(), i;
   for (i = mn + 1; i != v.end(); i++) {
      if (menor(i, mn)) mn = i;
   }
   cout << mn->first << ' ' << mn->last << endl;
}
