#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; string sa, sb, pa, pb; char xa, xb; int comp(string a, string b) { if (a.size() == b.size()) { if (a == b) return 0; else if (a > b) return 1; else return -1; } else if (a.size() > b.size()) return 1; else return -1; } int main() { cin >> sa >> pa >> xa; cin >> sb >> pb >> xb; int ans = comp(pa, pb); if (ans == 1) cout << sa << endl; else if (ans == -1) cout << sb << endl; else cout << -1 << endl; return 0; }