import sys
import numpy as np
from itertools import combinations


def input():
    return sys.stdin.readline()[:-1]


def solve():
    al=[chr(ord('a') + i) for i in range(26)]
    n = int(input())
    a = np.arange(n).tolist()
    base = "a"*n
    res = []
    for i in range(1, n+1):
        base = list("a"*n)
        com = list(combinations(a,i))
        for j, c in enumerate(com):
            for j, num in enumerate(sorted(list(c))):
                base[int(num)] = al[j]
            res.append(''.join(base))
    res = list(sorted(list(set(res))))
    for ans in res:
        print(ans)

    


if __name__ == "__main__":
    solve()
