S = input R = range P = print def I(): return int(S()) def M(): return map(int, S().split()) def L(): return list(M()) def O(): return list(map(int, open(0).read().split())) def yn(b): print("Yes" if b else "No") biga = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" smaa = "abcdefghijklmnopqrstuvwxyz" for _ in R(I()): n = I() if n*(n+1)//2%2: print(-1) continue k = n*(n+1)//4 x = n a = [] while k >= x: k -= x a.append(x) x -= 1 if k > 0: a.append(k) ans = ['0'] * n for i in a: ans[i - 1] = '1' print(''.join(ans))