#include <bits/stdc++.h>
using namespace std;
vector<int> vals;
vector<string> strs;
int n;
void genall(int ind) {
  if (ind == n) {
    string s = "";
    int alpha = 0;
    for (int i = 0; i < n; i++) {
      if (vals[i] == i) {
        s.push_back(char('a' + alpha));
        alpha++;
      } else {
        s.push_back(s[vals[i]]);
      }
    }
    strs.push_back(s);
    return;
  }
  for (int i = 0; i <= ind; i++) {
    vals[ind] = i;
    genall(ind + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  vals.resize(n);
  genall(0);
  sort(strs.begin(), strs.end());
  for (string s : strs) {
    cout << s << '\n';
  }
  return 0;
}
