#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif int main() { int t; cin >> t; while(t--){ int n; cin >> n; int m = n*(n+1)/2; if(m%2){ cout << -1 << endl; continue; } vector> dp(n+1, vector(m)); dp[0][0] = 1; rep(i,n){ rep(j,m+1){ if(!dp[i][j]) continue; if(j+i+1<=m) dp[i+1][j+i+1] = dp[i][j]; dp[i+1][j] = dp[i][j]; } } if(!dp[n][m/2]){ cout << -1 << endl; continue; } int now = m/2; vector ans; for(int i=n-1;i>=0;i--){ if(now-i-1<0) { ans.push_back(0); } else{ if(dp[i][now-i-1]) { now -= (i+1); ans.push_back(1); } else{ ans.push_back(0); } } } reverse(ans.begin(),ans.end()); for(int a : ans){ cout << a; } cout << endl; } return 0; }