import sequtils, strutils, sugar let t1, t2 = stdin.readLine.split if t1[1] > t2[1]: echo t1[0] elif t1[1] < t2[1]: echo t2[0] else: echo -1