f = input() s_f = f.split() a = int(s_f[1]) g = input() g_f = g.split() b = int(g_f[1]) if a < b: print(g_f[0]) elif b < a: print(s_f[0]) else: print('-1')