#include <bits/stdc++.h>
using namespace std;
int N;
vector<string> ans;
void dfs(string tmp, int mx) {
  int p = tmp.length();
  if (p == N) {
    ans.push_back(tmp);
    return;
  }
  int tl = max((int)(tmp[p - 1] - 'a' + 1), mx);
  for (int i = 0; i <= tl; i++) {
    dfs(tmp + (char)('a' + i), tl);
  }
  return;
}
int main() {
  cin >> N;
  dfs("a", 1);
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
