#include <bits/stdc++.h>
using namespace std;
vector<string> s;
string cs;
int curr[10], n;
void dfs(int pos, int depth) {
  if (pos == n) {
    s.push_back(cs);
    return;
  }
  if (curr[pos]) {
    cs += 'a' + curr[pos] - 1;
    dfs(pos + 1, depth);
    for (int i = pos + 1; i < n; ++i) {
      if (curr[i] == 0) {
        curr[i] = curr[pos];
        dfs(pos + 1, depth);
        curr[i] = 0;
      }
    }
    cs.pop_back();
  } else {
    cs += 'a' + depth;
    dfs(pos + 1, depth + 1);
    for (int i = pos + 1; i < n; ++i) {
      if (curr[i] == 0) {
        curr[i] = depth;
        dfs(pos + 1, depth + 1);
        curr[i] = 0;
      }
    }
    cs.pop_back();
  }
}
int main() {
  scanf("%d", &n);
  curr[0] = 1;
  dfs(0, 1);
  sort(s.begin(), s.end());
  for (auto& i : s) puts(i.c_str());
  return 0;
}
