from itertools import product

N = int(input())
added = set()
ans = []
a = [[chr(97+i) for i in range(j)] for j in range(1,N+1)]
for x in product(*a):
    temp = 'a'
    count = 1
    appeared = set('a')
    rle = []
    for y in x[1:]:
        appeared.add(y)
        if y != temp:
            rle.append(count)
            count = 1
            temp = y
        else:
            count += 1
    rle.append(count)
    rle.append(len(appeared))
    t = tuple(rle)
    if t not in added:
        print(''.join(x))
        added.add(t)