#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; // a < b: -1 // a == b: 0 // a > b: +1 inline int comp(string a, string b) { if (a.size() < b.size()) return -1; if (a.size() > b.size()) return 1; if (a == b) return 0; if (a < b) return -1; return 1; } int main() { string sa, pa, xa, sb, pb, xb; cin >> sa >> pa >> xa >> sb >> pb >> xb; int res = comp(pa, pb); if (res == 0) { cout << -1 << endl; } else { cout << (res == 1 ? sa : sb) << endl; } return 0; }