#include "bits/stdc++.h"
using namespace std;
using li = long long;
const char newl = '\n';
template <class T> vector<vector<T>> vv(const unsigned int n, const unsigned int m, const T x) { return vector<vector<T>>(n, vector<T>(m, x)); }
template <class T> vector<vector<vector<T>>> vvv(const unsigned int n, const unsigned int m, const unsigned int k, const T x) { return vector<vector<vector<T>>>(n, vv(m, k, x)); }
template <class T> bool contains(const set<T>& s, const T& v) { return s.find(v) != s.end(); }
template <class T> bool contains(const unordered_set<T>& s, const T& v) { return s.find(v) != s.end(); }
template <class K, class V> bool contains_key(const map<K, V>& m, const K& v) { return m.find(v) != m.end(); }

void solve() {
    li n;
    cin >> n;
    if (n % 2 == 1) {
        cout << -1 << newl;
        return;
    }
    n /= 2;
    vector<li> ans;
    li bit = 1;
    while (n) {
        if (n % 2 == 1) {
            if (bit == 1) {
                ans.emplace_back(1);
            } else {
                ans.emplace_back(1);
                ans.emplace_back(1);
                for (int i = 2; i < bit; ++i) {
                    ans.emplace_back(0);
                }
            }
        }
        n /= 2;
        bit++;
    }
    cout << ans.size() << newl;
    for (int i = 0; i < ans.size(); ++i) {
        cout << ans[i];
        if (i + 1 == ans.size()) {
            cout << newl;
        } else {
            cout << " ";
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    li t;
    cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }


    return 0;
}