#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll k;
		cin>>k;
		if(k&1)puts("-1");
		else
		{
			vector<int>ans;
			while(k)
			{
				if(k>=2)
				{
					ans.push_back(1);
					k-=2;
				}
				ll now=4;
				while(k>=now)
				{
					ans.push_back(0);
					k-=now;
					now*=2;
				}
			}
			cout<<ans.size()<<endl;
			for(auto i:ans)printf("%d ",i);
			puts("");
		}
	}
	return 0;
}