#include <bits/stdc++.h>

using namespace std;
#define int long long
#define pb push_back
const int maxn=5e5;
int dp[63];
int32_t main(){
	ios_base::sync_with_stdio(0);
	dp[0]=0;
	for(int i=1;i<61;i++){
        dp[i]=dp[i-1]*2+2;
	}
	int t;
	cin>>t;
	while(t--){
        int k;
        cin>>k;
        if(k%2){
            cout<<-1<<endl;
            continue;
        }
        vector<int> ans;
        ans.clear();
        for(int i=60;i>=1;i--){
            while(k>=dp[i]){
                k-=dp[i];
                ans.pb(i);
            }
        }
        vector<int> javab;
        for(int i=0;i<ans.size();i++){
            javab.pb(1);
            int x=ans[i]-1;
            while(x--)
                javab.pb(0);
        }
        cout<<javab.size()<<endl;
        for(int i=0;i<javab.size();i++)
            cout<<javab[i]<<" ";
        cout<<endl;
	}
}
