#include<bits/stdc++.h>
using namespace std;
#define ll long long
int T;
ll k;
int main()
{
    ios::sync_with_stdio(false);
    cin >> T;
    while(T--){
        cin >> k;
        if(k & 1){
            cout << - 1 << '\n';
            continue;
        }
        ll tmp = k;
        vector<int> v, ans;
        while(tmp){
            v.push_back(tmp & 1);
            tmp >>= 1;
        }
        int cnt = 0;
        ans.push_back(1);
        for(int i = 0; i < v.size(); ++i){
            if(v[i] == 1){
                if(i == 1){
                    ++cnt; continue;
                }
                for(int j = 0; j < i - 2; ++j) ans.push_back(0);;
                ans.push_back(1);
                ++cnt;
            }
        }
        for(int i = 1; i <= cnt - 1; ++i){
            ans.push_back(1);
        }
        cout << ans.size() << '\n';
        for(int i = 0; i < ans.size(); ++i){
            cout << ans[i] << ' ';
        }
        cout << '\n';
    }
    return 0;
}