#include <bits/stdc++.h>
using namespace std;
void ib() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n;
vector<string> V;
int To[30], Inv[30];
bool cek(string a, string b) {
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if (a[i] == a[j]) {
        if (b[i] != b[j]) return 1;
      }
      if (b[i] == b[j]) {
        if (a[i] != a[j]) return 1;
      }
    }
  }
  if (a > b) return 0;
  return 1;
}
void bt(int pos, string s) {
  if (pos == n) {
    bool check = true;
    for (int i = 0; i < V.size(); i++) {
      if (cek(s, V[i]) == false) {
        check = false;
        break;
      }
    }
    if (!check) return;
    V.push_back(s);
    return;
  }
  for (int i = 1; i <= n; i++) {
    bt(pos + 1, s + (char)(i - 1 + 'a'));
  }
}
int main() {
  cin >> n;
  bt(0, "");
  for (auto s : V) cout << s << endl;
  return 0;
}
