import sys
sys.setrecursionlimit(500000)

N = int(input())
global ans
ans = []
def dfs(now,rank,root_):
    root = root_[:]
    if rank == N:
        root.append(now)
        ans.append(''.join([chr(i+ord('a')) for i in root]))
    else:
        root.append(now)
        for i in range(now+2):
            dfs(i,rank+1,root)

dfs(0,1,[])
ans.sort()
print(*ans,sep='\n')