from collections import deque
N=int(input())
d=deque()
d.append("a")
dall=deque()
dall.append(d)
i=0
while i<N-1:
    length=len(dall)
    j=0
    while j<length:
        l=dall.popleft()
        st=l.pop()
        l.append(st)
        llen=len(l)
        for k in range(ord(st)-ord("a")+2):
            q = deque()
            for m in range(llen):
                c = l.popleft()
                q.append(c)
                l.append(c)
            q.append(chr(ord("a")+k))
            dall.append(q)
        j=j+1
    i=i+1
    #print(dall)
    #input()
#print(len(dall))
ans=[]
for i in range(len(dall)):
    print("".join(dall[i]))
