#include <iostream> #include <vector> using namespace std; void solve (int N) { if ((N*(N+1)/2) % 2 == 1) { cout << "-1\n"; return; } // 総和が初めて半分以上になるとき、ある程度大きなNに対して必ず調整が効く int sum = 0; vector<bool> took(N+1, false); for (int i = 1; i <= N; i++) { sum += i; took[i] = true; if (N*(N+1)/2 <= 2*sum) { if (N*(N+1)/2 == 2*sum) break; // ひとつ引けば達成可能 took[sum - N*(N+1)/4] = false; break; } } for (int i = 1; i <= N; i++) { if (took[i]) { cout << "0"; } else { cout << "1"; } } cout << "\n"; } int main () { int T; cin >> T; while (T--) { int N; cin >> N; solve(N); } }