#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll mod = 1000000007;
const double eps = 1e-8;
vector<string> ans;
int N;
void dfs(int k, vector<int> &t, int las) {
  if (k == N) {
    string s;
    for (int i = 0; i < N; ++i) {
      s += char('a' + t[i]);
    }
    ans.push_back(s);
    return;
  }
  for (int i = 0; i <= min(k, las + 1); ++i) {
    t.push_back(i);
    dfs(k + 1, t, i);
    t.pop_back();
  }
}
int main() {
  cin >> N;
  vector<int> t;
  dfs(0, t, -1);
  for (string s : ans) {
    cout << s << endl;
  }
  return 0;
}
