#include <bits/stdc++.h>
using namespace std;
const long long int LINF = 2000000000000000000ll;
const int INF = 1000000100;
const long long int MOD = 1e9 + 7;
int n;
vector<string> ans;
string alpha = "abcdefghijklmn";
void dfs(string s, int d) {
  if (d >= n) {
    set<char> st;
    int mx = 0;
    for (char c : s) {
      st.insert(c);
      mx = max(mx, c - 'a' + 1);
    }
    if (st.size() < mx) return;
    ans.push_back(s);
    return;
  }
  for (int i = 0; i < (d + 1); ++i) {
    dfs(s + alpha[i], d + 1);
  }
}
int main() {
  cin >> n;
  dfs("a", 1);
  for (string s : ans) {
    cout << s << endl;
  }
  return 0;
}
