#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3 + 10;
ll f[65];

int main() {
    int T; cin >> T;
    f[0] = 2;
    for (int i = 1; i <= 60; ++ i) f[i] = f[i-1]*2 + 2;
    while (T--) {
        ll x; cin >> x;
        ll sum = 0;
        vector<int> ans;
        if (x & 1) {cout << -1 <<endl; continue;}
        for (int i = 60; i >= 0; -- i)
            while (f[i] <= x)
                x -= f[i], ans.push_back(i), sum += i + 1;

        cout << sum << endl;
        for (int i = 0; i < ans.size(); ++ i) {
            cout << 1 << " ";
            for (int j = 0; j < ans[i]; ++ j)
                cout << 0 << " ";
        }
        cout << endl;
    }
    return 0;
}

   		 	  		  	              	 	