#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
int n, lim;
string s;
vector<string> ans;
void dfs(int cur, int curl) {
  if (cur == n) {
    if (curl == lim) ans.push_back(s);
    return;
  }
  if (curl == lim) {
    for (int i = 0; i <= lim; ++i) s[cur] = i + 'a', dfs(cur + 1, curl);
  } else {
    s[cur] = curl + 'a', dfs(cur + 1, curl);
    if (curl < lim) s[cur] = curl + 1 + 'a', dfs(cur + 1, curl + 1);
  }
}
void init() { n = read(); }
void solve() {
  for (int i = 0; i < n; ++i) s.push_back('a');
  s[0] = 'a';
  for (int j = 1; j <= n; ++j) {
    lim = j - 1;
    dfs(1, 0);
  }
  sort(ans.begin(), ans.end());
  for (auto& x : ans) cout << x << endl;
}
int main() {
  init();
  solve();
  return 0;
}
