#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int mod = 1000000007;
int n;
vector<string> G;
int id[11];
void Dfs(int p, int tot) {
  if (p > n) {
    string tmp;
    for (int i = 1; i <= n; ++i) tmp += 'a' + id[i] - 1;
    G.push_back(tmp);
    return;
  }
  for (int i = 1; i <= p - 1; ++i) {
    id[p] = id[i];
    Dfs(p + 1, tot);
  }
  id[p] = tot + 1;
  Dfs(p + 1, tot + 1);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  Dfs(1, 0);
  sort(G.begin(), G.end());
  for (auto s : G) {
    cout << s << '\n';
  }
  return 0;
}
