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