T=int(input()) for t in range(T): N=int(input()) if N%4 in (1,2): print(-1) else: ans_lst=[] if N%4==3: ans_lst.append(0) ans_lst.append(0) ans_lst.append(1) while len(ans_lst)