#include <bits/stdc++.h>
using namespace std;
int n;
set<string> st;
void solve(int i, vector<int> ary) {
  if (i == n) {
    string str(n, 'a');
    int ch = 'a';
    bool flag = true;
    for (int i = 0; i < (n); i++) {
      if (ary[i] && flag) {
        for (int j = i; j < n; j++) {
          if (ary[j]) str[j] = (char)ch;
        }
        flag = false;
      } else if (ary[i] == 0) {
        str[i] = (char)ch;
      }
      ch++;
    }
    st.insert(str);
    return;
  }
  ary[i] = 0;
  solve(i + 1, ary);
  ary[i]++;
  solve(i + 1, ary);
  return;
}
int main() {
  cin >> n;
  vector<int> a(n);
  solve(0, a);
  for (string s : st) cout << s << "\n";
  return 0;
}
