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