def f(n, count=0, i=0, lst=[]):
    global ans
    if count == n:
        s = ""
        for j in range(count):
            s += chr(ord("a") + lst[j])
        ans.append(s)
        return
    if i == 0:
        lst.append(i)
        f(n, count + 1, i=i+1, lst=lst)
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j), lst=lst+[j])

import sys
sys.setrecursionlimit(10000)
n = int(input())
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)