#include <bits/stdc++.h>
#pragma comment(linker, "/stack:247474112")
#pragma GCC optimize("Ofast")
using namespace std;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  set<string> ans;
  string s;
  for (int i = 0; i < n; ++i) {
    s += char('a' + i);
  }
  ans.insert(s);
  for (int msk = 1; msk < 1 << n; ++msk) {
    vector<int> A(n);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      if ((msk >> i) & 1) {
        A[i] = 1;
        ++cnt;
      }
    }
    if (cnt < 2) continue;
    char sta = 'a';
    char c = 0;
    string t;
    for (int i = 0; i < n; ++i) {
      if (A[i] == 1) {
        if (c == 0) c = sta;
        t += c;
      } else {
        t += sta;
        ++sta;
      }
    }
    ans.insert(t);
  }
  for (auto x : ans) cout << x << endl;
}
