import itertools

N = int(input())
l = list(range(N))
lst = []
for i in itertools.product(l,repeat = N):
    _max = i[0]
    if i[0] != 0:
        break
    flg = True
    for j in range(len(i)-1):
        _max = max(_max, i[j])
        if i[j+1] > _max + 1:
            flg = False
            break
    if flg:
        lst.append(i)
for i in lst:
    for j in i:
        print(chr(ord('a')+j),end="")
    print("")    
          