#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
void solve(long long N, string S) {
  if (N == 0)
    ans.push_back(S);
  else {
    long long p = S.size();
    char end = S[p - 1];
    end++;
    for (char c = 'a'; c <= end; c++) {
      S += c;
      solve(N - 1, S);
      S.erase(S.begin() + p - 1);
    }
  }
}
signed main() {
  long long N;
  cin >> N;
  solve(N - 1, "a");
  sort(ans.begin(), ans.end());
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << endl;
}
