#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
string s;
long long n;
vector<string> mem;
void fuck(string s, long long cur, long long type) {
  string res = s;
  for (int i = (n - 1); i > cur; i--) {
    res[i] = char(type + 'a');
    for (int j = 1; j <= (type + 1); j++) {
      fuck(res, i, j);
    }
    res[i] = s[i];
  }
  mem.push_back(s);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    s.push_back('a');
  }
  fuck(s, 0, 1);
  sort(mem.begin(), mem.end());
  cout << mem[0] << '\n';
  for (int i = 1; i < mem.size(); i++)
    if (mem[i] != mem[i - 1]) cout << mem[i] << '\n';
}
