#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char **argv) {
	long long t, k;
	
	cin >> t;
	
	while (t--) {
		cin >> k;
		if (k & 1) {cout << -1 << endl;continue;}
		
		k = (k - 2) >> 1;
		vector<int> n(1, 1);
		int p = -1;
		while (k) {
			if (k & 1) {
				n.push_back(1);
				if (p >= 0) {
					n.insert(n.end(), p, 0);
					n.push_back(1);
				}
			}
			k >>= 1;
			p++;
		}
		cout << n.size() << endl;
		for (int i = 0; i < n.size(); i++) cout << (i ? " " : "") << n[i];
		cout << endl;
	}
	
	return 0;
}
			
		
		
