SA, PA, _ = input().split() SB, PB, _ = input().split() PA, PB = int(PA), int(PB) if PA > PB: print(SA) elif PA < PB: print(SB) else: print(-1)