#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define m(a) memset(a,0,sizeof(a))
int a[2005];
int main(){
	int t;cin>>t;
    while(t--){
        ll k;cin>>k;
        if(k%2==1){
            cout<<-1<<endl;
            continue;
        }
        m(a);
        a[1]=1;
        int num=1;
        while(k){
            int c;
            for(c=1;(1ll<<(c+1))-2<=k;c++);
            num+=c-1;
            a[num]=1;
            k-=(1ll<<c)-2;
        }
        cout<<num-1<<endl;
        for(int i=1;i<num;i++){
            cout<<a[i]<<' ';
        }
        cout<<endl;
    }

}