#include #include #include using namespace std; int main() { string sa, pa, xa; string sb, pb, xb; cin >> sa >> pa >> xa; cin >> sb >> pb >> xb; if (pa == pb) { cout << -1 << endl; } else { bool win_a; if (pa.size() < pb.size()) { win_a = false; } else if (pa.size() > pb.size()) { win_a = true; } else { win_a = pa > pb; } cout << (win_a ? sa : sb) << endl; } return 0; }