#include <bits/stdc++.h>
using namespace std;
const static string ASCII("abcdefghijklmnopqrstuvwxyz");
int N;
string canonical(const string& s) {
  unordered_map<char, string> m;
  auto it = ASCII.cbegin();
  string res;
  for (char c : s) {
    if (m.find(c) == m.end()) {
      m[c] = *it;
      ++it;
    }
    res += m[c];
  }
  return res;
}
void rec(int n, string& s, unordered_set<string>* seen) {
  if (n == N) {
    string can = canonical(s);
    seen->insert(can);
  } else {
    for (char c : ASCII.substr(0, n + 1)) {
      s.push_back(c);
      rec(n + 1, s, seen);
      s.pop_back();
    }
  }
}
int main() {
  cin >> N;
  unordered_set<string> seen;
  seen.reserve(3628800);
  string s;
  rec(0, s, &seen);
  set<string> ss(seen.begin(), seen.end());
  for (const auto& s : ss) printf("%s\n", s.c_str());
}
