#include <bits/stdc++.h>
using namespace std;
const long double EPS = 0.001;
const long double EPS2 = 1e-6;
const long double PI = acos(-1);
int mod = (int)998244353;
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const int inf = 1e9;
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
int n;
string now = "";
set<string> ans;
void rec(int pos) {
  if (pos == n) {
    string trueform = now;
    string tkek = now;
    sort((trueform).begin(), (trueform).end());
    trueform.resize(unique((trueform).begin(), (trueform).end()) -
                    trueform.begin());
    for (int i = 0; i < now.size(); ++i) {
      tkek[i] = lower_bound((trueform).begin(), (trueform).end(), now[i]) -
                trueform.begin() + 'a';
    }
    ans.insert(tkek);
    return;
  }
  for (char x = 'a'; x <= 'a' + pos; ++x) {
    now.push_back(x);
    rec(pos + 1);
    now.pop_back();
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  cin >> n;
  now = "a";
  rec(1);
  for (auto i : ans) {
    cout << i << '\n';
  }
}
