#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18L + 1;
int main() {
  int n;
  cin >> n;
  string base = "";
  for (int i = 0; i < (n); ++i) base += 'a' + i;
  set<string> s;
  for (int i = (1 << n) - 1; i >= 0; i--) {
    string str = base;
    int firstOne;
    for (int j = n - 1; j >= 0; j--) {
      if (1 & (i >> j)) {
        firstOne = (n - j) - 1;
        break;
      }
    }
    for (int j = n - 1; j >= 0; j--) {
      if (1 & (i >> j)) {
        str[n - j - 1] = base[firstOne];
      }
    }
    s.insert(str);
  }
  for (auto it = s.begin(); it != s.end(); it++) cout << *it << endl;
  return 0;
}
