#include <algorithm>
#include <cstdio>
// #include <iostream>
// #include <string>
// #include <ctime>
#include <queue>
// #include <random>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
// priority_queue<long long, vector<long long>, greater<long long>> minor_que;
long long x[100], k;
void solve(int casei) {
  // ...
  if (k % 2) {
    printf("-1\n");
    return;
  }
  x[1] = 2;
  for (int i = 2; i < 60; ++i) {
    x[i] = 2 * (1ll + x[i - 1]);
  }
  vector<int> res;
  while (k) {
    int i;
    for (i = 1; x[i] <= k; ++i);
    i--;
    k -= x[i];
    res.push_back(i);
  }
  int ans = 0;
  for (int i = 0; i < int(res.size()); ++i) {
    ans += res[i];
  }
  printf("%d\n", ans);
  for (int i = 0; i < int(res.size()); ++i) {
    printf("1 ");
    for (int j = 1; j < res[i]; ++j) {
      printf("0 ");
    }
  }
  printf("\n");
}
int main() {
  int Case = 1;
  scanf("%d", &Case);
  // ios::sync_with_stdio(false);
  // cin.tie(0);
  // cin >> Case;
  for (int casei = 1; casei <= Case; ++casei) {
    // ...
    scanf("%lld", &k);
    solve(casei);
  }
  return 0;
}
