#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<string> ans;
void solve(int i, string s) {
  if (s[s.size() - 1] >= 'a' + n) return;
  if (i == n) {
    ans.push_back(s);
    return;
  }
  for (int j = 'a'; j < 'a' + n; j++) {
    solve(i + 1, s + char(j));
  }
}
int main() {
  cin >> n;
  solve(1, "a");
  set<string> sol;
  for (auto u : ans) {
    string cpy = u;
    int ok = 1;
    for (auto u : ans) {
      string cpy = u;
      map<char, char> vis;
      char nxt = 'a';
      string nw = "";
      for (auto v : cpy) {
        if (!vis[v]) {
          vis[v] = nxt++;
        }
        nw += vis[v];
      }
      sol.insert(nw);
    }
  }
  for (auto u : sol) {
    string cpy = u;
    int ok = 1;
    sort(cpy.begin(), cpy.end());
    for (int i = 1; i < cpy.size(); i++) {
      if (cpy[i] - cpy[i - 1] > 1) {
        ok = 0;
        break;
      }
    }
    if (ok) cout << u << "\n";
  }
  return 0;
}
