#include <bits/stdc++.h>
using namespace std;
class make_str {
 public:
  make_str(int Nval);
  ~make_str();
  vector<string>& main_calc();

 private:
  void calc_str(string str, int num, int cnt);

 private:
  int Nv = 0;
  string alphabet = "abcdefghijklmnopqrstuvwxyz";
  string inistr = "";
  vector<string> ans;
};
make_str::make_str(int Nval) {
  ans.clear();
  Nv = Nval;
  for (int i = 0; i < Nv; i++) {
    inistr += "a";
  }
}
make_str::~make_str() {}
void make_str::calc_str(string str, int num, int cnt) {
  string cstr;
  cstr = str;
  if (num == Nv) {
    ans.push_back(str);
    return;
  } else {
    calc_str(cstr, num + 1, cnt);
    cstr[num] = alphabet[cnt];
    calc_str(cstr, num + 1, cnt + 1);
    calc_str(cstr, num + 1, cnt);
  }
}
vector<string>& make_str::main_calc() {
  calc_str(inistr, 1, 1);
  return ans;
}
int main() {
  int N = 0;
  cin >> N;
  make_str ms(N);
  vector<string> ansv = ms.main_calc();
  sort(ansv.begin(), ansv.end());
  for (int i = 0; i < ansv.size(); i++) {
    cout << ansv[i] << endl;
  }
  return 0;
}
