s,t,_ = input().split() ss,tt,_ = input().split() if int(t) > int(tt): print(s) elif int(t) < int(tt): print(ss) else: print(-1)