#include <bits/stdc++.h>
#define qio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) cerr<<#x<<" "<<x<<endl
#define ll long long 
#define st first
#define nd second
using namespace std;

unsigned ll n, t, k, x, temp, sum;
vector <int> res;
int main()
{
	qio;
	cin >> t;

	for (int i = 1; i <= t;i++) {
		cin >> k;
		res.clear();
		if (k % 2 == 1) cout << -1 << endl;
		else {
			res.push_back(1);
			k -= 2;
			x = 1;
			while (k != 0) {
				temp = 2;
				while (2 * temp + 2 <= k) {
					temp = 2 * temp + 2;
					res.push_back(0);
				}
				res.push_back(1);
				k -= temp;
			}
			cout << res.size() << endl;
			for (int j = 0; j < res.size(); j++) {
				cout << res[j] << " ";
			}
			cout << endl;
		}
	}


}
