#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main() {
  int n;
  cin >> n;

  vector<string> res;
  res.emplace_back("a");
  auto dfs = [&](auto& f, int d)->void {
    if (d == n) return ;
    int m = sz(res);
    vector<string> nres;
    for (int i = 0; i < m; i++) {
      int k = res[i][d - 1] - 'a';
      for (int j = 0; j <= k + 1; j++) {
        nres.emplace_back(res[i] + (char)('a' + j));
      }
    }
    swap(res, nres);
    f(f, d + 1);
  };
  dfs(dfs, 1);
  res.erase(unique(res.begin(), res.end()), res.end());
  for (auto e : res) cout << e << endl;
  return 0;
}