def cur(n):
    if ans[n]!=[]: return ans[n]
    for x in cur(n-1):
        tmp1=[0]+[x[i] for i in range(n-1)]
        tmp2=[0]+[x[i]+1 for i in range(n-1)]
        ans[n].append(tmp1)
        ans[n].append(tmp2)
        if sum(x)!=0:
            for k in range(1,max(x)+1):
                tmp3=[0]+[x[i] for i in range(n-1)]
                for i in range(1,n):
                    if tmp3[i]>k: tmp3[i]-=1
                    elif tmp3[i]==k: tmp3[i]=0
                    else: tmp3[i]+=1
                ans[n].append(tmp3)
    
    return ans[n]

def pri(x):
    s=""
    for i in range(p):
        s+=chr( ord("a")+x[i] )
    print(s)

p=int(input())
ans=[[] for i in range(11)]
ans[1]=[[0]]
ans[2]=[[0,0],[0,1]]
cur(p)

ans[p].sort()
pri(ans[p][0])
for i in range(1,len(ans[p])):
    if ans[p][i]!=ans[p][i-1]: pri(ans[p][i])