from itertools import*
from collections import*

start="a"
n=int(input())
d=defaultdict(set)
c=1
ans=[]

def dfs(tf,string,n,c):
    if len(string)==n:
        ans.append(string)
    else:
        s=string
        c+=1
        
        for sc in range(c):
            s=chr(97+sc)
#            print(s)
            tmp=string+s
            x=defaultdict(list)
            for k,v in enumerate(tmp):
                x[v].append(k)
            lc=0
            tmpl=[0]*len(tmp)
            for l in x.values():
                for i in l:
                    tmpl[i]=lc
                lc+=1
            if d[tuple(tmpl)]:
                continue
            else:
                d[tuple(tmpl)]=1
                dfs(d,tmp,n,c)

dfs(d,start,n,c)


for item in sorted(ans):
    print(item)