#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n;
string ans = "";
vector<char> v(10);
void DFS(int depth, string s, int NOW) {
  if (depth == n) {
    cout << s << endl;
    return;
  } else {
    for (int i = 0; i <= NOW; i++) {
      DFS(depth + 1, s + v.at(i), (int)v.at(i) - 96);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < 10; i++) {
    v.at(i) = (char)i + 97;
  }
  DFS(0, ans, 0);
}
