#include #include using namespace std; int main(){ string a,b,c,d; int pa,pb; cin >> a >> pa >> c; cin >> b >> pb >> d; if( pa == pb ) cout << -1 << endl; else if( pa > pb ) cout << a << endl; else cout << b << endl; return 0; }