/*
*/
#include <bits/stdc++.h>
#define pc putchar
#define gc() getchar()
typedef long long LL;
const int N=1e6+5;

int A[N];

inline LL read()
{
	LL now=0,f=1; char c=gc();
	for(;!isdigit(c);c=='-'&&(f=-1),c=gc());
	for(;isdigit(c);now=now*10+c-48,c=gc());
	return now*f;
}

int main()
{
	for(int T=read(); T--; )
	{
		LL k=read();
		if(k&1) {puts("-1"); continue;}
		int cnt=0;
		for(; k; )
		{
			LL t=-3,val=1;
			while(k+2>=val) val<<=1, ++t;
			k-=(val>>1)-2, A[++cnt]=1;
			while(t--) A[++cnt]=0;
		}
		printf("%d\n",cnt);
		for(int i=1; i<=cnt; printf("%d ",A[i++])); pc('\n');
	}
	
	
	
	

	return 0;
}