#include <bits/stdc++.h>
using namespace std;

signed main(){
  int n; cin >> n;
  n--;
  vector<stirng> now{"a"};
  while(n--){
    vector<string> next;
    for(const auto &S: now){
      char c = *(max_element(S.begin(), S.end()));
      c++;
      for(char d='a'; d<=c; d++){
        next.push_back(S + d);
      }
    }
    now = next;
  }
  
  for(const auto &S: now){
    cout << S << endl;
  }
  
  return 0;
}