from itertools import combinations_with_replacement

N = int(input())
C = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Ans = set()

for ans in combinations_with_replacement(C[:N], N):
    a = ''
    d = dict()
    now = ord('a')
    for c in ans:
        if c not in d:
            d[c] = chr(now)
            now += 1
        a += d[c]
    Ans.add(a)

A = []
for ax in Ans:
    A.append(ax)
A.sort()
for a in A:
    print(a)




