for _ in range(int(input())):
n = int(input())
s = input()
lst = []
ans = [0] * n
for i in s:
lst.append(int(i))
if n % 2 == 1:
if ((n // 2 + 1) * n) % 2 == 1:
print(-1)
continue
else:
for i in range(n // 2):
if i % 2 == 0:
if lst[i] == 0:
ans[i] = 1
else:
ans[i] = 3
else:
if lst[i] == 0:
ans[i] = 2
else:
ans[i] = 4
for i in range(n // 2, n - 1):
if i % 2 == 1:
if lst[i] == 0:
ans[i] = 1
else:
ans[i] = 3
else:
if lst[i] == 0:
ans[i] = 2
else:
ans[i] = 4
if lst[n-1] == 0:
ans[n-1] = 2
else:
ans[n-1] = 4
else:
if (n // 2) % 2 == 1:
print(-1)
continue
else:
for i in range(n // 2):
if i % 2 == 1:
if lst[i] == 0:
ans[i] = 2
else:
ans[i] = 4
else:
if lst[i] == 0:
ans[i] = 1
else:
ans[i] = 3
for i in range(n//2, n):
if i % 2 == 0:
if lst[i] == 0:
ans[i] = 2
else:
ans[i] = 4
else:
if lst[i] == 0:
ans[i] = 1
else:
ans[i] = 3
see = ''
for i in ans:
see += str(i)
print(see)