#include <bits/stdc++.h>
using namespace std;
void go(string s, int mx, int n, vector<string>& ans) {
  if (n == 0) {
    ans.push_back(s);
    return;
  }
  for (int i = 0; i <= mx; ++i) {
    go(s + char('a' + i), max(mx, i + 1), n - 1, ans);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> ans;
  go("", 0, n, ans);
  for (auto& s : ans) {
    cout << s << '\n';
  }
}
