#include <bits/stdc++.h>
constexpr int MAXN = 1e5 + 5;
constexpr long long M = 998244353;
constexpr double EPS = 1e-7;
using namespace std;
template <typename T>
inline void read(T &x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
  x *= f;
}
struct segTree {
  using Node = segTree *;
  Node lson, rson;
  int l, r;
  long long mul;
} Tree[MAXN << 1];
using LL = long long;
int n;
string s;
vector<string> vec;
inline void search() {
  for (int i = 1; i < n; i++) {
    if (s[i] < 'a' + n - 2) {
      s[i]++;
      vec.emplace_back(s);
      search();
      s[i]--;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  s.resize(n);
  for (int i = 0; i < n; i++) s[i] = 'a';
  vec.emplace_back(s);
  search();
  for (int i = 0; i < n; i++) s[i] += i;
  vec.emplace_back(s);
  sort(vec.begin(), vec.end());
  int cnt = unique(vec.begin(), vec.end()) - vec.begin();
  for (int i = 0; i < cnt; i++) cout << vec[i] << endl;
  return 0;
}
