INF = 1<<60 for _ in range(int(input())): N = int(input()) if N.bit_count() == 1: print(-1) continue cnt = 0 for i in range(INF): if 1<