#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 5;
int n, len, q;
string s[maxn], ans;
void dfs(int x) {
  if (x == n) {
    s[++len] = ans;
    return;
  }
  for (int i = 0; i <= 10; i++) {
    if (i > x) continue;
    ans += (char)(i + 'a');
    dfs(x + 1);
    ans.pop_back();
  }
}
map<string, int> p;
int vis[15];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  dfs(0);
  for (int i = 1; i <= len; i++) {
    memset(vis, 0, sizeof(vis)), q = 0;
    for (int j = 0; j < n; j++) {
      if (!vis[s[i][j] - 'a']) s[i][j] = (q + 'a'), q++;
      vis[s[i][j] - 'a']++;
    }
    p[s[i]] = 1;
  }
  for (auto i : p) cout << i.first << endl;
}
