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]


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

for x in ans[n]:
    s=""
    for i in range(n):
        s+=chr( ord("a")+x[i] )
    print(s)