import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())

    ans = []

    def solve(s, n, xset):
        if n >= N:
            ans.append(s)
            return

        f = False
        cnt = 0
        for i in range(n + 1):
            if chr(ord('a') + i) not in xset:
                if f:
                    continue
                xset.add(chr(ord('a') + i))
                solve(s + chr(ord('a') + i), n + 1, xset)
                f = True
                cnt += 1
            else:
                solve(s + chr(ord('a') + i), n + 1, xset)
                cnt += 1

            if cnt == len(xset) + 1:
                break

    sset = set()
    sset.add('a')
    solve('a', 1, sset)
    ans.sort()
    for a in ans:
        print(a)



if __name__ == '__main__':
    main()
