#include <bits/stdc++.h>
using namespace std;
const static string ASCII("abcdefghijklmnopqrstuvwxyz");
size_t N;
string canonical(const string& s) {
  char m[26];
  fill(m, m + 26, '!');
  int i = 0;
  string r;
  for (char c : s) {
    if (m[c - 'a'] == '!') {
      m[c - 'a'] = ASCII[i++];
    }
    r += m[c - 'a'];
  }
  return r;
}
string canonical2(const string& s) {
  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;
}
int main() {
  cin >> N;
  unordered_set<string> ans;
  stack<string> stk;
  stk.push("");
  while (stk.size()) {
    string s = stk.top();
    stk.pop();
    if (s.size() == N)
      ans.insert(canonical2(s));
    else
      for (char c = 'a'; c <= ASCII[s.size()]; c++) stk.push(s + c);
  }
  set<string> ss(ans.begin(), ans.end());
  for (auto& s : ss) printf("%s\n", s.c_str());
}
