#include <bits/stdc++.h>
const int INF = 2147483647;
const long long int MOD = 1000000007;
using namespace std;
void dfs(int n, char prev, vector<string> &ans, char ma, string current) {
  if ((int)current.length() == n) {
    ans.push_back(current);
    return;
  }
  int m = ma - 'a' + 1;
  for (int i = 0; i < m; i++) {
    char ima = 'a' + i;
    string po = current + ima;
    char tmp = ma < ima ? ima : ma;
    dfs(n, 'a' + i, ans, tmp, po);
  }
  if (ma == prev) {
    char ima = 'a' + m;
    current += ima;
    dfs(n, ima, ans, ima, current);
  }
}
int main() {
  int n;
  cin >> n;
  vector<string> ans;
  dfs(n, 'a', ans, 'a', "a");
  int len = ans.size();
  for (int i = 0; i < len; i++) {
    cout << ans[i] << endl;
  }
}
