from collections import deque
N = int(input())
alpha = ['a','b','c','d','e','f','g','h','i','j']
ans = []

stack = deque(['a'])

while stack:
    print(stack)
    if len(stack[-1]) == N:
        break
    s = stack.pop()
    s_list = list(s)
    index = alpha.index(s_list[-1])
    print(index)
    for i in range(index+2):
        stack.appendleft(s+alpha[i])
    

stack.reverse()
for j in range(len(stack)):
    print(stack[j])

