#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int n;
set<string> ans;

void solve(int ind, char c, string str)
{
    if(ind>n) return ;
    if(c-'a'>=n) return ;
    if(ind==n)
    {
        if(str.length()!=n)
        {
            return ;
        }
        
        ans.insert(str);
    }

    for(int i = c; i>='a'; --i)
        solve(ind+1, c, str+string(1, c));

    solve(ind+1, c+1, str+string(1, c+1));
}

int main()
{
    cin>>n;
    if(n==1)
    {
        cout<<"a"<<endl;
        return 0;
    }

    solve(1, 'a', "a");
    for(auto& it : ans)
    {
        cout<<it<<endl;
    }
}