#include <bits/stdc++.h>
using namespace std;
void dfs(string str, int N,
         priority_queue<string, vector<string>, greater<string>>& q) {
  size_t size = str.size();
  if (size != N) {
    dfs(str + 'a', N, q);
  } else {
    q.push(str);
  }
  if (size == 1) return;
  --size;
  if (str[size] - str[size - 1] < 1) {
    str[size] += 1;
    dfs(str, N, q);
  }
}
int main() {
  int N;
  cin >> N;
  priority_queue<string, vector<string>, greater<string>> q;
  dfs("a", N, q);
  while (!q.empty()) {
    cout << q.top() << endl;
    q.pop();
  }
  return 0;
}
