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

#define chota(a) transform(a.begin(), a.end(), a.begin(), ::tolower)
#define pure cout << fixed << setprecision(18)
#define kitnabit(x) __builtin_popcount(x)
#define ll long long
#define newline cout << "\n"
#define speed ios_base::sync_with_stdio(0); cin.tie(0)

const int N = 60;
long long k;
long long powerOf[N];
vector<int> ans;

void preProcess() {
    powerOf[1] = 2;
    for (int i = 2; i <= 57; i++) {
        powerOf[i] = powerOf[i - 1] * 2LL + 2;
    }
}
void clearEverything() {
   ans.clear();
}


void solve(int tno) {
    cin >> k;
    clearEverything();
    long long copyOfK = k;
    
    if (k & 1) {
        cout << "-1" << endl;
        return;
    }
    
    while (copyOfK >= 2) {
        for (int i = 57; i >= 1; i--) {
            if (powerOf[i] <= copyOfK) {
                ans.push_back(i);
                copyOfK -= powerOf[i];
                break;
            }
        }
    }
    vector<int> finalAns;

    for (int x : ans) {
        if (x == 1) {
            finalAns.push_back(1);
        } else {
            finalAns.push_back(1);
            for (int j = 1; j <= (x - 1); j++) finalAns.push_back(0);
        }
    }
    cout << (int) finalAns.size() << endl;
    for (int x : finalAns) cout << x << " ";
    newline;
}
int main() {
    speed;
    int t = 1;
    cin >> t;
    preProcess();
    for (int i = 1; i <= t; i++) {
        solve(i);
    }
}