#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using namespace std;
set<string> st;
int N;
void solve(string ans, int start, int cur) {
  if (cur == 0 or start == cur) {
    return;
  }
  solve(ans, start, cur - 1);
  for (int i = 1; i <= (ans[cur - 1] - 'a' + 1); ++i) {
    ans[cur] = (char)('a' + i);
    st.insert(ans);
    solve(ans, cur, N - 1);
  }
  return;
}
int main() {
  cin >> N;
  if (N == 1) {
    cout << "a" << endl;
    return 0;
  }
  if (N == 2) {
    cout << "aa" << endl;
    cout << "ab" << endl;
    return 0;
  }
  string ans(N, 'a'), tmp = ans;
  st.insert(ans);
  tmp[N - 1] = 'b';
  st.insert(tmp);
  tmp = ans;
  for (int cur = N - 2; cur > 0; --cur) {
    tmp = ans;
    tmp[cur] = 'b';
    cout << tmp << endl;
    solve(tmp, cur, N - 1);
  }
  for (auto& tmp : st) {
    cout << tmp << endl;
  }
}
