#include <bits/stdc++.h>
using namespace std;
long long int inf = 1e9;
int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) a[i] = i;
  vector<string> s;
  vector<vector<int> > b;
  b.push_back(a);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = b.size() - 1; j >= 0; j--) {
      vector<int> tmp = b[j];
      for (int k = 0; k < i; k++) {
        tmp[i] = k;
        b.push_back(tmp);
      }
    }
  }
  for (auto i : b) {
    string tmp;
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (i[j] == j) {
        tmp += (char)('a' + cnt);
        cnt++;
      } else {
        tmp += tmp[i[j]];
      }
    }
    s.push_back(tmp);
  }
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());
  for (auto i : s) cout << i << endl;
  return 0;
}
