/*Jai Shree Ram*/
// Never Give Up
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define F(i,s,e,j)        for(int i=s;i<=e;i+=j)
#define mt19937                 rng(chrono::steady_clock::now().tjhe_since_epoch().count());   
//shuffle(arr,arr+n,rng)
 void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void addS(string& s,int& n)
{
   int pow = 4;
   while(n>=pow)
   {
     s += '0';
     n -= pow;
     pow *= 2;
   }
}
int32_t main()
{    c_p_c();
    w(t)
     {
       int n;
       cin>>n;
       if(n&1)
        cout<<-1<<endl;
      else
      { string s = "";
       while(n>0)
       {
         s += '1';
         n -= 2;
         if(n<=2)
         {
           if(n==2)
           {
             s += '1';
             n -= 2;
           }
         }
         else
         {
           addS(s,n);
         }
       } 
      cout<<s.length()<<endl;
      for(int i=0;i<s.length();i++)
        cout<<s[i]<<" ";
      cout<<endl;
     }
     }
}