#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;
vector<string> ans;
int n;
void dfs(int k, string s, char prev) {
  if (k == n) {
    ans.push_back(s);
    return;
  }
  if (k == 0) {
    s += 'a';
    dfs(k + 1, s, 'a');
    return;
  }
  for (int i = 0; i <= k; i++) {
    string copy = s;
    char t = 'a' + i;
    copy += t;
    if (t > prev + 1) {
      return;
    }
    dfs(k + 1, copy, t);
  }
  return;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n;
  dfs(0, "", 'a');
  sort((ans).begin(), (ans).end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << ln;
  }
  return 0;
}
