#include #include using namespace std; int main() { string name[2]; string yp[2]; string h[2]; for (int i = 0; i < 2; i++) { cin >> name[i] >> yp[i] >> h[i]; } if (yp[0].size() > yp[1].size()) cout << name[0] << endl; else if (yp[0].size() < yp[1].size()) cout << name[1] << endl; else { if (yp[0] > yp[1]) { cout << name[0] << endl; } else if (yp[0] < yp[1]) { cout << name[1] << endl; } else cout << "-1" << endl; } return 0; }