import itertools
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
N = int(input())
cnt = 0
for i in range(1, N+1):
    c = itertools.product(alp[:i], repeat=i)
    for j in c:
        if alp[:len(set(j))] != sorted(list(set(j))):
            continue
        print(''.join(j))
        if list(j) == alp[:len(j)]:
            break
