#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7LL;
const int INF = 2e9;
priority_queue<string, vector<string>, greater<string>> a[10];
int N;
set<char> S;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  a[0].push("a");
  S.insert('a');
  for (int i = 0; i < N; ++i) {
    if (i == 0) continue;
    priority_queue<string, vector<string>, greater<string>> que = a[i - 1];
    while (!que.empty()) {
      string s = que.top();
      que.pop();
      set<char> st;
      for (int i = 0; i < s.size(); ++i) st.insert(s[i]);
      for (auto it = st.begin(); it != st.end(); ++it) {
        char k = *it;
        a[i].push(s + k);
      }
      if (que.empty()) {
        char c = s[s.size() - 1] + 1;
        S.insert(c);
        a[i].push(s + c);
      }
    }
  }
  priority_queue<string, vector<string>, greater<string>> que2 = a[N - 1];
  while (!que2.empty()) {
    string s = que2.top();
    que2.pop();
    cout << s << endl;
  }
  return 0;
}
