#include <bits/stdc++.h>
using namespace std;
set<string> ans;
int n;
void dfs(string s, int cur, int m) {
  ans.insert(s);
  if (cur == n) {
    return;
  }
  dfs(s, cur + 1, m);
  if (s[cur] - 'a' < cur && (s[cur] - 'a') <= m) {
    s[cur] += 1;
    dfs(s, cur, m + 1);
  }
}
int main() {
  cin >> n;
  if (n == 1) {
    cout << 'a' << '\n';
    return 0;
  }
  string base = "";
  for (int i = 0; i < n; ++i) {
    base += 'a';
  }
  dfs(base, 1, 0);
  for (auto &e : ans) {
    cout << e << '\n';
  }
  return 0;
}
