import sys
import math

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [[-1] * N for _ in range(math.factorial(N))]
for i in range(math.factorial(N)):
    used = set()
    for j in range(1, N+1):
        for k in range((i%j)+1):
            if k not in used:
                A[i][j-1] = k
                used.add(k)
                break
        if A[i][j-1] == -1:
            A[i][j-1] = i%j
            used.add(i%j)

B = set()
for x in A:
    B.add(tuple(x))
A = sorted(list(B))
for x in A:
    x = [chr(y + ord('a')) for y in x]
    print(''.join(x))
