#include using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); string a,b,aa,bb; char g; cin>>a>>aa>>g>>b>>bb>>g; cout<<(aa==bb?"-1"s:aa>bb?a:b)<<"\n"s; }