from itertools import permutations

N=int(input())

st=["a","b","c","d","e","f","g","h","i","j"]

st=st[:N]
ans_ls=[]
if N==1:
    print("a")
else:
    print("a"*N)
    for i in range(2,len(st)):
        ans=st[:i]
        while len(ans)!=N:
            ans.append("a")
        for v in set(list(permutations(ans))):
            
            ans_ls.append("".join(v))

    ans_ls.sort()
    for i in range(len(ans_ls)):
        print(ans_ls[i])
    print("".join(st))






    

