#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
const ll inf = (1e18);
constexpr ll mod = 998244353;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
struct __INIT {
  __INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll n;
V<string> s;
void dfs(string str, int cnt, char bfo) {
  if (cnt == n) {
    s.emplace_back(str);
    return;
  }
  char d = char((bfo - 'a' + 1) + 'a');
  str.push_back('a');
  for (char i = 'a'; i <= d; i++) {
    str[cnt] = i;
    dfs(str, cnt + 1, i);
  }
}
int main() {
  cin >> n;
  if (n < 3) return 0;
  string t = "a";
  dfs(t, 1, 'a');
  sort((s).begin(), (s).end());
  int cnt = 1;
  V<pair<string, int>> dat;
  for (int i = 0; i < s.size(); i++) {
    V<int> c(n, 0);
    cnt = 1;
    string p = {};
    for (int j = 0; j < n; j++) {
      if (c[s[i][j] - 'a'] == 0) c[s[i][j] - 'a'] = cnt++;
      p.push_back(char(c[s[i][j] - 'a'] + '0'));
    }
    dat.emplace_back(p, i);
  }
  sort((dat).begin(), (dat).end());
  string bfo = "**";
  V<string> ans;
  for (int i = 0; i < dat.size(); i++) {
    if (bfo != dat[i].first) {
      ans.emplace_back(s[dat[i].second]);
      bfo = dat[i].first;
    }
  }
  sort((ans).begin(), (ans).end());
  for (string &str : ans) {
    cout << str << "\n";
  }
}
