// https://qoj.ac/submission/74195 #include #include using namespace std; const int o = 1e6; int n, K, pth[o], cnt, nxt[o]; bool vis[o]; int solve() { auto dfs = [&](auto &&self, int nw) -> void { if (vis[nw]) return; vis[nw] = 1; self(self, nw * 2 % (1 << K)); self(self, (nw * 2 + 1) % (1 << K)); pth[++cnt] = nw; }; scanf("%d", &n); for (int i = 0; i <= 2 * n + 10; i++) { pth[i] = 0; vis[i] = 0; nxt[i] = 0; } K = 0; cnt = 0; if (n == 1) { putchar(97); return 0; } for (; (1 << K) + K - 1 <= n; ++K); --K; dfs(dfs, 0); for (int i = 1, j = cnt; i < j; swap(pth[i++], pth[j--])); if (n == (1 << K) + K - 1) { for (int i = 1; i < K; ++i) putchar(97); for (int i = 1; i <= cnt; ++i) putchar(97 + pth[i] % 2); return 0; } for (int i = 0; i < (1 << (K + 1)); ++i) vis[i] = 0, nxt[i] = -1; for (int i = 1; i <= cnt; ++i) vis[pth[i] = (pth[i] << 1) | (pth[i + 1] & 1)] = 1; for (int i = 1; i <= cnt; ++i) nxt[pth[i]] = pth[i % cnt + 1]; for (int i = 0; i < (1 << (K + 1)); ++i) if (nxt[i] < 0) nxt[i] = nxt[i ^ (1 << K)] ^ 1; for (int i = 0, t; i < (1 << (K + 1)); ++i) if (!vis[i]) { for (t = i; !vis[t]; t = nxt[t]) vis[t] = 1, ++cnt; swap(nxt[i], nxt[i ^ (1 << K)]); if (cnt + K >= n) { for (int j = K; j + 1; --j) putchar(97 + ((nxt[i] >> j) & 1)); for (int j = K + 2, t = nxt[nxt[i]]; j <= n; ++j, t = nxt[t]) putchar(97 + (t & 1)); break; } } return 0; } int main() { int t; cin >> t; while (t--) { solve(); cout << endl; } return 0; }