#include <bits/stdc++.h>
using namespace std;
template <class Type_a, class Type_b>
bool chmax(Type_a &a, const Type_b &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class Type_a, class Type_b>
bool chmin(Type_a &a, const Type_b &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class Type>
void line(const Type &a) {
  int cnt = 0;
  for (const auto &elem : a) {
    if (cnt++) cout << ' ';
    cout << elem;
  }
  cout << endl;
}
int n;
set<string> ans;
void dfs(int num, vector<int> tmp) {
  if (num == n) {
    string res;
    char key = 'b';
    map<int, char> mp;
    for (int i = 0; i < (n); ++i) {
      if (tmp[i] == 0) {
        res += 'a';
      } else if (mp[tmp[i]] == 0) {
        mp[tmp[i]] = key - 'a';
        res += key++;
      } else {
        res += ('a' + mp[tmp[i]]);
      }
    }
    ans.insert(res);
    return;
  }
  for (int i = 0; i < (num + 1); ++i) {
    tmp[num] = i;
    dfs(num + 1, tmp);
  }
}
int main() {
  cin >> n;
  vector<int> tmp(n);
  dfs(0, tmp);
  for (auto elem : ans) {
    cout << elem << endl;
  }
}
