T = int(input()) D = dict() for _ in range(T): N = int(input()) if N in D: print(D[N]) continue SUM = (1+N)*N//2 if SUM%2 == 1: D[N] = -1 print(D[N]) continue dp = [[False]*(SUM//2+1) for _ in range(N+1)] dp[0][0] = True for i in range(N): for j in range(SUM//2+1): if dp[i][j]: dp[i+1][j] = dp[i][j] if j+i+1 <= SUM//2: dp[i+1][j+i+1] = dp[i][j] if not dp[-1][-1]: D[N] = -1 print(D[N]) continue ans = [] idx = SUM//2 for i in reversed(range(N)): if dp[i][idx]: ans.append("0") else: ans.append("1") idx -= i+1 D[N] = "".join(ans[::-1]) print(D[N])