#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;
int t;
ll k;
int main(){
    //ios::sync_with_stdio(false);
    //freopen("in","r",stdin);
    cin>>t;
    while(t--){
        cin>>k;
        if(k&1) puts("-1");
        else{
            vector<int>v;
            for(int i=61;i>=2;i--){
                ll ret=(1ll<<i)-2;
                while(k>=ret){
                    k-=ret;
                    v.pb(1);
                    for(int j=1;j<i-1;j++) v.pb(0);
                }
            }
            cout<<sz(v)<<endl;
            for(int x:v) cout<<x<<' ';
            cout<<endl;
        }
    }
    return 0;
}