#include <bits/stdc++.h>
using namespace std;
const int MAXN = 15;
int n;
string cur;
vector<string> all;
void dfs(char id) {
  int ptr = 0;
  while (ptr < n && cur[ptr] != '\0') {
    ptr++;
  }
  if (ptr == n) {
    all.push_back(cur);
    return;
  }
  vector<int> pos;
  for (int i = ptr + 1; i < n; i++) {
    if (cur[i] == '\0') {
      pos.push_back(i);
    }
  }
  int cnt = pos.size();
  for (int i = 0; i < (1 << cnt); i++) {
    cur[ptr] = id;
    for (int j = 0; j < cnt; j++) {
      if (i >> j & 1) {
        cur[pos[j]] = id;
      }
    }
    dfs(id + 1);
    cur[ptr] = '\0';
    for (int j = 0; j < cnt; j++) {
      cur[pos[j]] = '\0';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cur.resize(n, '\0');
  dfs('a');
  sort(all.begin(), all.end());
  for (string second : all) {
    cout << second << '\n';
  }
  cout << all.size() << '\n';
}
