import sys
# import numpy as np
# readline = sys.stdin.readline
# readlines = sys.stdin.readlines

# S = input()
# N, M = map(int, input().split())
# As = [int(input()) for _ in range(N)]
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    solve()


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

    use = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    ans = ['a'] * N
    cand = [use[:i+1] for i in range(N)]

    app = []
    apnd(ans, 0, cand, app)

    for ap in app:
        last = 0
        flg = True

        for s in ap:
            idx = use.index(s)
            if idx - last > 1:
                flg = False
                break
            last = max(last, idx)
        if flg:
            print(ap)


def apnd(s, n, cand, app): # 文字列sのn文字目を変換
    if n >= len(cand):
        app.append(''.join(s))
        return app

    ls = cand[n]
    for i, c in enumerate(ls):
        s[n] = c
        app = apnd(s, n+1, cand, app)

    return app


if __name__ == '__main__':
    main()
