#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define ll long long
#define pb push_back
#define Mid ((L+R)/2)
#define pi pair<int,int>
#define pii pair<int,pi>
#define deb(x) cout<<#x<<"="<<x<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int t;
int is[2020],last[2020];
ll ans[2010];
int main()
{
    go;
    cin>>t;
    while(t--)
    {
        ll k;
        cin>>k;
        if(k&1)
        {
            cout<<-1<<endl;
            continue;
        }
        int sz=1;
        ans[1]=2;
        is[1]=last[1]=1;
        k-=2;
        for(int i=2; i<=2000; i++)
        {
            if(!k)
            {
                sz=i-1;
                break;
            }
            last[i]=last[i-1];
            ans[i]=ans[i-1];
            //deb(ans[i]-ans[last[i]-1]);
            if(k>=(ans[i]-ans[last[i]-1]+2))
            {
                ans[i]+=(ans[i]-ans[last[i]-1]+2);
                is[i]=0;
            }
            else
            {
                is[i]=1;
                last[i]=i;
                ans[i]+=2;
            }
            k-=ans[i]-ans[i-1];
        }
        if(k)
            cout<<-1<<endl;
        else
        {
            cout<<sz<<endl;
            for(int i=1; i<=sz; i++)
                cout<<is[i]<< " " ;
            cout<<endl;
        }
    }
    return 0;
}
