#include <bits/stdc++.h>
using namespace std;
set<string> st;
string coordinate(string s) {
  int n = s.size();
  vector<char> a(n), b(n);
  for (int i = 0; i < n; i++) {
    a[i] = s[i];
    b[i] = s[i];
  }
  map<char, int> mp;
  int k = 0;
  for (int i = 0; i < n; i++) {
    auto itr = mp.find(a[i]);
    if (itr == mp.end()) {
      mp[a[i]] = k++;
    }
  }
  string t = "";
  for (int i = 0; i < n; i++) {
    t += mp[b[i]] + 'a';
  }
  return t;
}
void solve(int n, string s, int m) {
  char t = 'a';
  if (m == n) {
    s = coordinate(s);
    auto itr = st.find(s);
    if (itr == st.end()) {
      st.insert(s);
      cout << s << endl;
    }
    return;
  }
  for (int i = 0; i < n; i++) {
    char t = 'a';
    t += i;
    solve(n, s + t, m + 1);
  }
}
int main() {
  int n;
  cin >> n;
  st.clear();
  solve(n, "", 0);
}
