N = int(input())



def it(remain,n):

    if remain == 0:

        yield []

    else:

        for x in range(n+1):

            for d in it(remain-1,max(x+1,n)):

                d.append(x)

                yield d





print(*(''.join(chr(x+ord('a')) for x in reversed(d)) for d in it(N,0)), sep='\n')



N = int(input())



def it(i,n):

    if i == N:

        yield [None]*N

    else:

        for x in range(n):

            for d in it(i+1,n):

                d[i] = x

                yield d

        for d in it(i+1,n+1):

            d[i] = n

            yield d



print(*(''.join(chr(x+ord('a')) for x in d) for d in it(0,0)), sep='\n')



N = int(input())


def it(remain, n):
    if remain == 0:
        yield []
    else:
        for x in range(n + 1):
            for d in it(remain - 1, max(x + 1, n)):
                d.append(x)
                yield d


print(*("".join(chr(x + ord("a")) for x in reversed(d)) for d in it(N, 0)), sep="\n")

N = int(input())


def it(i, n):
    if i == N:
        yield [None] * N
    else:
        for x in range(n):
            for d in it(i + 1, n):
                d[i] = x
                yield d
        for d in it(i + 1, n + 1):
            d[i] = n
            yield d


print(*("".join(chr(x + ord("a")) for x in d) for d in it(0, 0)), sep="\n")

-def it(remain, n): -    if remain == 0: -        yield [] +def it(i, n): +    if i == N: +        yield [None] * N -        for x in range(n + 1): -            for d in it(remain - 1, max(x + 1, n)): -                d.append(x) +        for x in range(n): +            for d in it(i + 1, n): +                d[i] = x +        for d in it(i + 1, n + 1): +            d[i] = n +            yield d -print(*("".join(chr(x + ord("a")) for x in reversed(d)) for d in it(N, 0)), sep="\n") +print(*("".join(chr(x + ord("a")) for x in d) for d in it(0, 0)), sep="\n")