#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
int main() {
  int N;
  cin >> N;
  queue<string> que;
  vector<char> c;
  for (int i = 0; i < N; i++) {
    c.push_back(i + 'a');
  }
  que.push("a");
  for (int i = 1; i < N; i++) {
    int M = que.size();
    for (int j = 0; j < M; j++) {
      string p = que.front();
      que.pop();
      map<char, int> mp;
      for (int k = 0; k < N; k++) {
        mp[p[k]]++;
      }
      for (int k = 0; k < i + 1; k++) {
        if (mp[c[k]] > 0) que.push(p + c[k]);
      }
      for (int k = 0; k < i + 1; k++) {
        if (mp[c[k]] == 0) {
          que.push(p + c[k]);
          break;
        }
      }
    }
  }
  int M = que.size();
  for (int i = 0; i < M; i++) {
    cout << que.front() << "\n";
    que.pop();
  }
}
