#include <bits/stdc++.h>
using namespace std;

using ll = long long int;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
#define F first
#define S second

ll min(ll x, ll y){
    return ((x < y) ? x : y);
}

ll max(ll x, ll y){
    return ((x > y) ? x : y);
}
const ll INF = 1e18;

double findavg (ll x, ll itr){
    ll sum = 0;
    for (ll i = 0; itr > i; i++){
        ll mvs = 0;
        ll cur = 0;
        while (x > cur){
            ll rd = rand()%2;
            if (rd){
                cur++;
            }else cur = 0;
            mvs++;
        }
        cout << mvs << endl;
        sum += mvs;
    }
    double ans = (double)sum/(double)itr;
    cout << "x: " << x << " " << "itr: " << itr << endl;
    cout << ans << endl;
    return ans;
}

int main(){
    ll t; cin >> t;
    while (t--){
        ll k; cin >> k;
        if (k%2 == 1){
            cout << "-1\n";
            continue;
        }
        vi v;
        for (ll i = 1; 63 > i; i++){
            ll bm = 1;
            bm <<= i;
            if (k & bm){
                v.push_back(1);
                for (ll j = 0; i > j+1; j++){
                    if (j) v.push_back(0);
                    else v.push_back(1);
                }
            }

        }
        cout << v.size() << endl;
        for (auto i: v) cout << i << " ";
        cout << endl;
    }

}

