#include <map>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <sstream>
#include <bitset>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#define ll long long
#define ull unsigned long long
#define pi acos(-1)
#define PII pair<int,int>
#define fir first
#define sec second
#define INF 0x7f7f7f7f
#define mod 1000000007
#define Mod 998244353
#pragma GCC optimize(3 , "Ofast" , "inline")
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define gc getchar()
#define pc(x) putchar(x)
const double eps=1e-7;
const int maxn=2e3+100;
const int prime[15]= {2,3,5,7,11,13,17,19,23,29,31,37};
const int dir[4][2]={1,0,-1,0,0,1,0,-1};
int spgcd(int a,int b){while(b^=a^=b^=a%=b);return a;}
inline int mul(int a,int b,int p){return (ll)a*b%p;}
using namespace std;
void print(int n,vector<int>&v){
    v.pb(1);
//    cout<<1<<' ';
    for(int i=1;i<n-1;i++){
//        cout<<0<<' ';
        v.pb(0);
    }
}
void solve(){
    ll x;
    cin>>x;
    if(x&1){
        cout<<-1<<endl;
        return ;
    }
    vector<int>v;
    ll sum=0;
    for(ll i=1;x;i++){
        if(sum+(1ll<<i)>x){
//            cout<<sum<<endl;
            x-=sum;
            print(i,v);
            i=0;
            sum=0;
        }
        else sum+=1ll<<i;
//        cout<<x<<' '<<sum<<endl;
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<' ';
    cout<<endl;
}
int main()
{
    ios;
    int t;
    cin>>t;
    for(int i=1;i<=t;i++){
        solve();
    }
    return 0;
}
