import string

def generate(n, res, cur = None, alphabet = None):
    if cur is None:
        cur = []
    if alphabet is None:
        alphabet = list(string.ascii_lowercase)[::-1]
    if n == 0:
        res.append(''.join(cur))
        return
    for i in range(len(cur)):
        cur.append(cur[i])
        generate(n - 1, res, cur, alphabet)
        cur.pop()
    cur.append(alphabet.pop())
    generate(n - 1, res, cur, alphabet)
    alphabet.append(cur.pop())

res = []
generate(int(input()), res=res)
res.sort()
for row in res:
    print(row)
