#include <bits/stdc++.h>
using namespace std;
int n;
vector<char> v;
vector<string> ans;
bool check(string s) {
  char mx = 'a';
  for (int i = 0; i < (s.size()); i++) {
    if (s[i] > mx + 1) return false;
    mx = max(mx, s[i]);
  }
  return true;
}
void dfs(int i) {
  char j = 'a';
  while (j <= 'z') {
    if (i == 0 && j >= 'b') return;
    v[i] = j;
    if (i == n - 1) {
      string tmp;
      for (int i = 0; i < (n); i++) tmp += v[i];
      if (check(tmp)) ans.push_back(tmp);
    } else
      dfs(i + 1);
    j++;
  }
}
signed main(void) {
  cin >> n;
  v = vector<char>(n);
  dfs(0);
  for (int i = 0; i < (ans.size()); i++) cout << ans[i] << endl;
  return 0;
}
