import copy

def make(n, data):

    out = []

    # print(ord(data[-1]) + 1 - ord("a"))

    key = data[1]

    for i in range(key + 1):

        # print(key)

        out.append([data[0] + chr(ord("a") + i), max(key, i + 1)])

    return out



n = int(eval(input()))

ans = [["a", 1]]

for i in range(1, n):

    tmp = []



    for j in range(len(ans)):

        tmp += make(i + 1, ans[j])

            # print

    if len(tmp) >= 1:

        ans = copy.deepcopy(tmp)

    # print(ans)



for i in ans:

    print((i[0]))
def solve(n, s, mx):

    # print(n, s, mx)

    if n == 0:

        print(s)

    else:

        for i in range(mx):

            solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2))



n = int(eval(input()))

solve(n - 1, 'a', 2)
import copy


def make(n, data):
    out = []
    # print(ord(data[-1]) + 1 - ord("a"))
    key = data[1]
    for i in range(key + 1):
        # print(key)
        out.append([data[0] + chr(ord("a") + i), max(key, i + 1)])
    return out


n = int(eval(input()))
ans = [["a", 1]]
for i in range(1, n):
    tmp = []
    for j in range(len(ans)):
        tmp += make(i + 1, ans[j])
        # print
    if len(tmp) >= 1:
        ans = copy.deepcopy(tmp)
    # print(ans)
for i in ans:
    print((i[0]))

def solve(n, s, mx):
    # print(n, s, mx)
    if n == 0:
        print(s)
    else:
        for i in range(mx):
            solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2))


n = int(eval(input()))
solve(n - 1, "a", 2)

-import copy - - -def make(n, data): -    out = [] -    # print(ord(data[-1]) + 1 - ord("a")) -    key = data[1] -    for i in range(key + 1): -        # print(key) -        out.append([data[0] + chr(ord("a") + i), max(key, i + 1)]) -    return out +def solve(n, s, mx): +    # print(n, s, mx) +    if n == 0: +        print(s) +    else: +        for i in range(mx): +            solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2)) -ans = [["a", 1]] -for i in range(1, n): -    tmp = [] -    for j in range(len(ans)): -        tmp += make(i + 1, ans[j]) -        # print -    if len(tmp) >= 1: -        ans = copy.deepcopy(tmp) -    # print(ans) -for i in ans: -    print((i[0])) +solve(n - 1, "a", 2)