#include <bits/stdc++.h>

using i32 = int;
using i64 = long long;

i32 main() {
    std::ios::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);

    i64 dp[60] = {2};
    for (i32 i = 1; i < 60; i++) {
        dp[i] = 2 * (dp[i - 1] + 1);
    }

    i32 T;
    std::cin >> T;
    while (T--) {
        i64 x;
        std::cin >> x;
        if (x % 2 == 1) {
            std::cout << "-1\n";
        } else {
            x -= 2;
            std::string ans = "1";
            while (x != 0) {
                i32 p = std::upper_bound(dp, dp + 60, x) - dp;
                --p;
                for (i32 i = 0; i < p; i++) {
                    ans.push_back('0');
                }
                ans.push_back('1');
                x -= dp[p];
            }
            std::cout << ans.size() << "\n";
            for (char ch : ans) {
                std::cout << ch << " ";
            }
            std::cout << "\n";
        }
    }
    return 0;
}