#include <bits/stdc++.h>
using namespace std;
int a[2010];
typedef long long ll;
int main(){
    int t; cin>>t;
    while(t--){
        memset(a,0,sizeof a);
        int cur=1;
        ll n; cin>>n;
        if(n&1) puts("-1");
        else{
            a[cur]=1;
            while(n){
                int i;
                for(i=2;(1ll<<i)-2<=n;i++);
                i--;
                //cout<<i<<endl;
                n-=(1ll<<i)-2;
                cur+=i-1;
                
                a[cur]=1;
            }
            cout<<cur-1<<endl;
            for(int i=1;i<cur;i++){
                if(a[i]){
                    cout<<"1 ";
                }else{
                    cout<<"0 ";
                }
            }
            cout<<endl;
        }
        
    }
    return 0;
}