#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <deque>
#include <chrono>
#include <cassert>
#include <bitset>
#include <random>
using namespace std;
typedef int li;
typedef long double ld;
const li MAX = 1e6 + 20;
li inf = (li)1e9;
li mod = (li)1e9 + 7;
li n, k, used[MAX];
void solve() {
cin >> n;
for (int i = 0; i < n; i++) used[i] = 0;
string ans = { 0 };
used[0] = 1;
used[n / 2] = 1;
li curmod = n / 2;
for (int i = 0; i < n - 1; i++) {
if (curmod % 2) {
ans.push_back(1);
curmod--;
if (used[(curmod + n) / 2]) {
curmod = curmod / 2;
}
else {
curmod = (curmod + n) / 2;
}
}
else {
ans.push_back(0);
if (used[(curmod + n) / 2]) {
curmod = curmod / 2;
}
else {
curmod = (curmod + n) / 2;
}
}
used[curmod] = 1;
}
reverse(ans.begin(), ans.end());
for (int i = 0; i < n; i++) cout << int(ans[i]);
cout << "\n";
}
// 1 3 7 5
int main() {
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ios::sync_with_stdio(0);
freopen("unique.in", "r", stdin);
li q;
cin >> q;
while (q--) solve();
return 0;
}
I3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikKLy8jcHJhZ21hIEdDQyB0YXJnZXQoInNzZSxzc2UyLHNzZTMsc3NzZTMsc3NlNCxwb3BjbnQsYWJtLG1teCxhdngsdHVuZT1uYXRpdmUiKQojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8dW5vcmRlcmVkX3Nld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