from itertools import product

N = int(input())
added = set()
ans = []
a = [[i for i in range(j)] for j in range(1,N+1)]
for x in product(*a):
    count = 0
    appeared = set()
    temp = []
    order = [float('inf')] * N
    for y in x:
        if y not in appeared:
            order[y] = 97 + count
            count += 1
            appeared.add(y)
            temp.append(chr(order[y]))
        else:
            temp.append(chr(order[y]))
    s = ''.join(temp)
    if s not in added:
        ans.append(s)
        added.add(s)
print('\n'.join(ans))