#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
int N;
vector<string> ans;
map<string, int> mp;
void solve(int now, string &S) {
  if (mp.count(S)) return;
  mp[S] = 1;
  if (now == N) {
    ans.push_back(S);
    return;
  }
  for (int i = 0; i < now; i++) {
    string T = S;
    T += S[i];
    solve(now + 1, T);
  }
  string T = S;
  T += char('a' + now);
  solve(now + 1, T);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  string s = "a";
  solve(1, s);
  for (int i = 0; i < (ans.size()); ++i) cout << ans[i] << endl;
  return 0;
}
