#include <bits/stdc++.h>
#define FAST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define pb push_back
#define endl "\n"
#define rep(i, s, n)    for(ll i = s; i < (n); ++i)
#define F first
#define S second 
#define ll long long
#define sz(a) a.size()
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define vll vector<pll >
#define INF INT_MAX
#define inf 9e18
#define N int(2e5+5)
#define all(v) v.begin(),v.end()
#define mod 998244353
 
using namespace std;
ll add(ll a,ll b)
{
	return (a%hell+b%hell)%hell;
}
ll mul(ll a,ll b)
{
	return ((a%hell)*(b%hell))%hell;
}
ll n;
ll fast_pow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=ans*a;
		a=a*a;
		b>>=1;
	}
	return ans;
}
void solve()
{
	ll x,s=0,p;vi v;
	while(n>0)
	{
		// x=log2(n+2)*1ll-2;
		for(x=0;(1ll<<(x+2))-2<=n;x++);
		x-=1;
		p=(1ll<<(x+2))-2;
		n-=p;
		v.pb(x);s+=1+x;
	}
	cout<<s<<endl;
	for(auto i:v){cout<<1<<' ';rep(j,0,i)cout<<0<<' ';}
}
int main()
{
	FAST
	ll test=1;
	cin>>test;
	while(test--) 
	{
		cin>>n;
		if(n&1){cout<<-1<<endl;continue;}
		solve();
		cout<<endl;
	}
	return 0;
}