#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long oo = 1e9 + 10;
const int Max = 1e6 + 10;
const double eps = 1e-18;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int n;
void bt(vector<string> &res, int len, string ans, char cur) {
  if (len == n) {
    res.push_back(ans);
    return;
  }
  for (char c = 'a'; c <= cur; c++) {
    ans += c;
    if (c != cur)
      bt(res, len + 1, ans, cur);
    else
      bt(res, len + 1, ans, cur + 1);
    ans.pop_back();
  }
}
void solve() {
  cin >> n;
  vector<string> res;
  bt(res, 0, "", 'a');
  sort((res).begin(), (res).end());
  for (int i = 0; i < (int)(res.size()); i++) cout << res[i] << endl;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int ___T;
  cin >> ___T;
  for (int cs = 1; cs <= ___T; cs++) {
    solve();
  }
  return 0;
}
