s = input()
t = input()
x = float(s)
y = float(t)
a, b = map(int, s.split('.'))
c, d = map(int, t.split('.'))

if (x < y) != ((a, b) < (c, d)) or (x > y) != ((a, b) > (c, d)):
    print(-1)
else:
    print(s if x > y else t)
