import sys
def solve():
data = sys.stdin.read().split()
ptr = 0
q = int(data[ptr])
ptr += 1
for _ in range(q):
x = str(data[ptr])
ptr += 1
output = []
is_dubble = False
if int(x) % 2 == 0:
is_dubble = True
output.append(x)
print(''.join(output))
else:
x = list(x)
for i in range(len(x)):
if int(x[i]) % 2 == 0:
x[i],x[len(x)-1] = x[len(x)-1],x[i]
is_dubble = True
break
if is_dubble:
res = ''.join(x)
output.append(res)
else:
output.append('-1')
print(''.join(output))
solve()

京公网安备 11010502036488号