#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define double long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define fill(a,b) memset(a,b,sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t; cin>>t;
    while(t--){
        int k; cin>>k;
        if(k%2==1){
            cout<<-1<<endl;
            continue;
        }
        int val=0;
        vector<int> ans;
        for(int i=2;i<63;i++){
            if((1LL<<i)&k){
                val+=(1LL<<i)-2;
                ans.pb(1);
                for(int j=0;j<i-2;j++) ans.pb(0);
            }
        }
        for(int i=0;i<(k-val)/2;i++) ans.pb(1);
        cout<<sz(ans)<<endl;
        for(int it : ans) cout<<it<<" "; cout<<endl;
    }

}