#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


using namespace std;
using namespace __gnu_pbds;


#define LL long long
#define N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


set <string> s;


void go(int i,string &a,int n,vector <int> &v)
{
	if(i==n)
		{	
			for(int j=1;j<v.size();j++)
				{
					if(v[j-1]<v[j])
						return ;
				}
			s.insert(a);
		}
	else
		{
			for(int j=0;j<=i;j++)
				{
					a.push_back('a'+j);
					v[j]+=1;
					go(i+1,a,n,v);
					v[j]-=1;
					a.pop_back();
				}
			return ;
		}
}
int main() {

ios_base::sync_with_stdio(false);
cin.tie(NULL);	
	int t=1;
	//cin>>t;
	while(t--){
		int n;
		cin>>n;
		string x;
		for(int i=1;i<=1;i++)
			{	x.clear();
				vector <int> v;
				v.resize(n,0);
				go(0,x,n,v);
			}
		for(auto it:s)
			cout<<it<<"\n";
	}



return 0;
}