#include using namespace std; typedef long long ll; int main() { string sa, pa, xa, sb, pb, xb; cin >> sa >> pa >> xa; cin >> sb >> pb >> xb; if (pa.length() < pb.length()) { cout << sb << endl; } else if (pa.length() > pb.length()) { cout << sb << endl; } else { if (pa == pb) { cout << -1 << endl; } else if (pa < pb) { cout << sb << endl; } else { cout << sa << endl; } } }