fls = input().split() sls = input().split() fp = int(fls[1]) sp = int(sls[1]) if fp > sp: print(fls[0]) elif fp < sp: print(sls[0]) else: print(-1)