#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int mx[] = {-1, 1, 0, 0}, my[] = {0, 0, -1, 1};
int n;
vector<string> mk(int num) {
  vector<string> ret;
  if (num == 1) {
    ret.push_back("a");
    return ret;
  }
  auto res = mk(num - 1);
  for (auto x : res) {
    for (int i = 0; i < n; ++i) {
      ret.push_back(x + char('a' + i));
    }
  }
  return ret;
}
bool is_basic(string s) {
  char ma = 'a';
  for (int i = 0; i < (int)s.length(); ++i) {
    if (ma < s[i]) {
      if (ma + 1 < s[i])
        return 0;
      else {
        ma = s[i];
      }
    }
  }
  return 1;
}
int main() {
  cin >> n;
  auto v = mk(n);
  sort(v.begin(), v.end());
  for (auto x : v) {
    if (is_basic(x)) {
      cout << x << endl;
    }
  }
}
