#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
void dfs(string S, int k, int N) {
  if (k == N) {
    ans.push_back(S);
    return;
  }
  for (int i = 0; i <= k; i++) {
    string next_S = S;
    next_S += ('a' + i);
    dfs(next_S, k + 1, N);
  }
}
int main() {
  int N;
  cin >> N;
  string S = "";
  dfs(S, 0, N);
  for (string s : ans) {
    cout << s << endl;
  }
  return 0;
}
