#include <bits/stdc++.h>
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vc = vector<char>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using psl = pair<string, ll>;
string S = "abcdefghij";
int N;
set<string> st;
string compress(string S) {
  string t = S;
  map<char, int> mp;
  sort(t.begin(), t.end());
  int cnt = 0;
  char prev = ' ';
  for (auto c : t) {
    if (c == prev) continue;
    mp[c] = cnt;
    cnt++;
    prev = c;
  }
  string res = "";
  for (auto c : S) {
    res += (char)('a' + mp[c]);
  }
  return res;
}
void dfs(int n, string T, string res) {
  if (n >= N) {
    if (res > T) return;
    string cmp = compress(res);
    if (st.count(cmp) == 0) {
      cout << res << endl;
      st.insert(cmp);
    }
    return;
  }
  for (auto c : T) {
    dfs(n + 1, T, res + c);
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  st.clear();
  string T = S.substr(0, N);
  dfs(0, T, "");
  return 0;
}
