#include <string>
#include <iostream>
using namespace std;

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