#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
void dfs(string a, int n, int cnt, vector<string> &ans) {
  if (cnt == n) {
    ans.push_back(a);
    return;
  }
  ++cnt;
  char max_char = (a.empty()) ? 'a' : (char)((int)(a[a.size() - 1]) + 1);
  for (char c = 'a'; c <= max_char; ++c) {
    string next = a + c;
    dfs(next, n, cnt, ans);
  }
  return;
}
int main() {
  int n;
  cin >> n;
  vector<string> ans;
  dfs("", n, 0, ans);
  for (auto tmp_ans : ans) {
    cout << tmp_ans << endl;
  }
  return 0;
}
