from itertools import permutations

N = int(input())
ans = []

for p in permutations(range(N)):
    D = [-1] * N
    A = []
    for i in range(N):
        for j in range(N):
            if D[j] < p[i]:
                D[j] = p[i]
                A.append(j)
                break
    ans.append(tuple(A))

ans = sorted(set(ans))

for a in ans:
    s = ''.join(map(lambda x:chr(x+97),a))
    print(s)