import math


def solve():
    N = int(input())
    ans = {}
    for j in range(1 << N):
        A = ['a'] * N
        lowercase = list('bcdefghijklmnopqrstuvwxyz')
        for i in reversed(range(N)):
            # print(i, j, (1 << i) & j, A)
            if (1 << i) & j:
                idx = i
                if idx == N - 1 or A[idx] > 'a':
                    continue
                A[idx] = lowercase.pop(0)
                # print(i, j, idx, A, '#')
        # print(i, j, ''.join(reversed(A)))
        ans.update({''.join(reversed(A)): 0})

    for a in sorted(ans):
        print(a)


if __name__ == "__main__":
    solve()