#include <bits/stdc++.h>
using namespace std;
int N;
bool sat[12];
string build = "";
void dfs(int depth) {
  if (depth == N) {
    fill_n(sat, N + 1, false);
    int highest = 0;
    for (char c : build) {
      sat[c - 'a'] = true;
      highest = max(highest, c - 'a');
    }
    for (int i = 0; i <= highest; ++i) {
      if (!sat[i]) {
        return;
      }
    }
    cout << build << '\n';
    return;
  }
  for (int i = 0; i <= depth; ++i) {
    build += char(i + 'a');
    dfs(depth + 1);
    build.pop_back();
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  dfs(0);
}
