#include <bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int k=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}
	return k*f;
}
void write(int x){
	if(x<0)putchar('-'),x=-x;if(x>9)write(x/10);
	putchar(x%10+'0');
}
inline void writeln(int x){
	write(x);puts("");
}
int n,p[3010];
signed main()
{
	for(int T=read();T;T--){
		n=read();
		if(n%2==1){
			puts("-1");
			continue;
		}p[0]=0;
		for(int i=63;i>2;i--)if(n&(1ll<<i)){
			p[++p[0]]=1;
			for(int j=1;j<i-1;j++)p[++p[0]]=0;
			p[++p[0]]=1;
		}
		if(n&4)p[++p[0]]=1,p[++p[0]]=1;
		if(n&2)p[++p[0]]=1;
		writeln(p[0]);
		for(int i=1;i<=p[0];i++)write(p[i]),putchar(' ');
		puts("");
	}
	return 0;
}