#include using namespace std; int main() { string s, t, p, q; char c; cin >> s >> p >> c >> t >> q >> c; if (p == q) cout << -1 << endl; else if (p > q) cout << s << endl; else cout << t << endl; return 0; }