#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  set<string> ans;
  for (int i = 1; i <= N; i++) {
    vector<char> use;
    string base = "";
    for (int c = 0; c < i; c++) {
      use.push_back('a' + c);
      base += 'a' + c;
    }
    for (int k = 0; k < pow(i + 1, N - i); k++) {
      string temp = "";
      int n = k;
      char m = 'a';
      for (int j = 0; j < N - i; j++) {
        temp += use[n % i];
        m = max(m, use[n % i]);
        n /= (i + 1);
      }
      sort(temp.begin(), temp.end());
      for (int j = 1; j <= i; j++) {
        if (m <= base[j - 1]) {
          string add = base.substr(0, j) + temp;
          if (j < i) {
            add += base.substr(j);
          }
          ans.insert(add);
        }
      }
    }
  }
  for (string a : ans) {
    if (a.length() == N) {
      cout << a << endl;
    }
  }
}
