#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
char s[maxn];
int vis[20];
void dfs(int dps, int fin) {
  if (dps == fin) {
    int mx = 0;
    memset(vis, 0, sizeof(vis));
    bool flag = true;
    for (int i = 0; i < fin; i++) {
      if (s[i] - 'a' > i) {
        flag = false;
        break;
      }
      vis[s[i] - 'a'] = 1;
      mx = max(mx, s[i] - 'a');
    }
    for (int i = 0; i < mx; i++) {
      if (!vis[i]) {
        flag = false;
        break;
      }
    }
    if (flag) cout << s << '\n';
  } else {
    for (int i = 0; i < fin; i++) {
      s[dps] = 'a' + i;
      dfs(dps + 1, fin);
    }
  }
}
int main() {
  int n;
  cin >> n;
  s[n] = 0;
  dfs(0, n);
  getchar();
  getchar();
  return 0;
}
