#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); string a, b, c, d, s, t; cin >> a >> s >> c; cin >> b >> t >> d; if(s > t) cout << a << endl; else if(s < t) cout << b << endl; else cout << -1 << endl; return 0; }