N=int(input())
K=2**N-N
seq=[i for i in range(N)]
from itertools import combinations
ans=['a'*N]
ss=''
tt='a'
for i in range(N):
    ss+=tt
    tt=chr(ord(tt)+1)
ans.append(''.join(ss))
for i in range(2, N):
    for j in list(combinations(seq, i)):
        c='a'
        s=[0]*N
        s[0]=c
        first=True
        for k in range(0,N):
            if first and k in j:
                s[k]=c
                for m in j:
                    s[m]=c
                first=False
                c=chr(ord(c)+1)
            elif k in j:
                continue
            else:
                s[k]=c
                c=chr(ord(c)+1)
        ans.append(''.join(s))
ans.sort()
if N==1:
    print('a')
else:
    for i in ans:
        print(i)
