N = int(input())

from string import ascii_lowercase

from itertools import product

codes = set()
ans = []

def toCode(s):
    code = ''
    used = {}
    idx = 0
    for c in s:
        if c not in used.keys():
            used[c] = idx
            idx += 1
            code += str(used[c])
        else:
            code += str(used[c])
    return code

for k in product(ascii_lowercase[:N], repeat=N):
    s = ''.join(k)
    c = toCode(s)
    # print(c)
    if c not in codes:
        ans.append(s)
        codes.add(c)

# print(codes)

for i in sorted(ans):
    print(i)
# print(ans)
