import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd dp = [[0]*10000 for i in range(110)] dp[0][0] = 1 for i in range(1,110): for j in range(10000): dp[i][j] |= dp[i-1][j] dp[i][j] |= dp[i-1][j-i] t = int(input()) for i in range(t): n = int(input()) now = n*(n+1)//4 if n*(n+1)%4 != 0: print(-1) elif not dp[n][now]: print(-1) else: ans = [] id = n while id: if dp[id-1][now-id]: ans.append("1") now -= id else: ans.append("0") id -= 1 print("".join(ans[::-1]))