SA, PA, XA = [i for i in input().split()] SB, PB, XB = [i for i in input().split()] if int(PA) > int(PB): print(SA) if int(PA) < int(PB): print(SB) if int(PA) == int(PB): print(-1)