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):
    appeared = set('a')
    d = ['a']
    temp = [0]
    for y in x[1:]:
        if y not in appeared:
            appeared.add(y)
            d.append(y)
            temp.append(d.index(y))
        else:
            temp.append(d.index(y))
    t = tuple(temp)
    if t not in added:
        print(''.join(x))
        added.add(t)