#include <iostream>
using namespace std;

int main() {
  char X = '-', Y = '-', Z = '-', X2 = '-', Y2 = '-';
  cin >> X >> Y;
  cin >> X2 >> Y2;
  
  if (X > X2 && Y > Y2) {
    cout << X << Y;
  }
  if (X > X2 && Y < Y2) {
    cout << X << Y2;
  }
  if (X < X2 && Y > Y2) {
    cout << X2 << Y;
  }
    return 0;
}