while True:
try:
str_input = input()
for c in str_input:
if str_input.count(c) == 1:
print(c)
break
else:
print(-1)
except:
break
while True:
try:
str_input = input()
for c in str_input:
if str_input.count(c) == 1:
print(c)
break
else:
print(-1)
except:
break