import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from collections import deque
N = int(input())

s = 'a'
queue = deque()
queue.append(s)
# for i in range(N):
while True:
    a = queue.popleft()
    if len(a) == N:
        queue.append(a)
        break
    origin = a
    a = a[-1]
    s = 'a'
    end = chr(ord(a)+2)
    while s != end:
        queue.append(origin+s)
        s = chr(ord(s)+1)
ans = []
while queue:
    ans.append(queue.popleft())
for s in sorted(ans):
    print(s)