#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
#define endl '\n'

void solve(ll k){
	vector<int> ans;
	while(k>0){
		ans.push_back(1);
		int i=0;
		while(k>=(1ll<<(i+2))-2) i++;
		for(int j=1;j<i;j++) ans.push_back(0);
		k-=(1ll<<(i+1))-2;
	}
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++){
		cout<<ans[i]<<(i<ans.size()-1?' ':'\n');
	}
}

int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cout.setf(ios::fixed),cout.precision(3);
	int t;
	ll k;
	cin>>t;
	while(t--){
		cin>>k;
		if(k&1) cout<<-1<<endl;
		else solve(k);
	}
	return 0;
}