#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
  int N;
  cin >> N;
  vector<string> ans;
  
  auto dfs = [&](auto&& dfs_, string S, char m) -> void {
    if(S.size() == N) {
      ans.emplace_back(S);
      return;
    }
    
    for(char c = 'a'; c <= m; c++){
      dfs_(dfs_, S + c, (c == m ? m+1 : m));
    }
    return;
  };
  
  dfs(dfs, "", "a");
  for(auto& c : ans){
    cout << c << endl;
  }
}
