#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> memo;
void dp(string cur) {
  if (cur.size() == n) {
    memo.push_back(cur);
    return;
  }
  int largest = cur.back() - 'a' + 1;
  for (int i = 0; i <= largest; i++) {
    string temp = cur;
    temp.push_back('a' + i);
    dp(temp);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  string temp;
  temp.push_back('a');
  dp(temp);
  for (auto i : memo) {
    cout << i << '\n';
  }
}
