#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
set<string> st;
void f(int rest, string s,char mx)
{
    if (rest == 0)
    {
        if (flag)
        {
            st.insert(s);
        }
    }
    else
    {
        for (char c = 'a'; c <= mx;c++){
            f(rest - 1, s + c, max(c, mx));
        }
    }
}
int main()
{
    int n;
    cin >> n;
    string s = "";
    f(n,s,'a');
    for (auto e : st)
    {
        cout << e << endl;
    }
}