# coding: utf-8

# Your code here!

def solv1():

    n=int(eval(input()))

    

    a=[[]for i in range(n)]

    a[0]=[[0]]

    

    for i in range(n-1):

        b=[]

        for pa in a[i]:

    #        print(pa)

            el=[j for j in set(pa)]

    #        print(el)

            el.append(max(pa)+1)

            for l in el:

                b+=[pa+[l]]

    #    print(i,b)

        a[i+1]=b

    ans=[j for j in a[n-1]]

        #print(i)

    ans=sorted(ans)

    for i in ans:

        print((''.join([chr(j+97) for j in i])))



solv1()

# coding: utf-8

# Your code here!

def solv1():

    n=int(eval(input()))

    

    a=[[]for i in range(n)]

    a[0]=[[0]]

    

    for i in range(n-1):

        b=[]

        for pa in a[i]:

    #        print(pa)

            el=[j for j in set(pa)]

    #        print(el)

            el.append(max(pa)+1)

            for l in el:

                b+=[pa+[l]]

    #    print(i,b)

        a[i+1]=b

    ans=[j for j in a[n-1]]

        #print(i)

    #ans=sorted(ans)

    for i in ans:

        print((''.join([chr(j+97) for j in i])))



solv1()

# coding: utf-8
# Your code here!
def solv1():
    n = int(eval(input()))
    a = [[] for i in range(n)]
    a[0] = [[0]]
    for i in range(n - 1):
        b = []
        for pa in a[i]:
            #        print(pa)
            el = [j for j in set(pa)]
            #        print(el)
            el.append(max(pa) + 1)
            for l in el:
                b += [pa + [l]]
        #    print(i,b)
        a[i + 1] = b
    ans = [j for j in a[n - 1]]
    # print(i)
    ans = sorted(ans)
    for i in ans:
        print(("".join([chr(j + 97) for j in i])))


solv1()

# coding: utf-8
# Your code here!
def solv1():
    n = int(eval(input()))
    a = [[] for i in range(n)]
    a[0] = [[0]]
    for i in range(n - 1):
        b = []
        for pa in a[i]:
            #        print(pa)
            el = [j for j in set(pa)]
            #        print(el)
            el.append(max(pa) + 1)
            for l in el:
                b += [pa + [l]]
        #    print(i,b)
        a[i + 1] = b
    ans = [j for j in a[n - 1]]
    # print(i)
    # ans=sorted(ans)
    for i in ans:
        print(("".join([chr(j + 97) for j in i])))


solv1()

-    ans = sorted(ans) +    # ans=sorted(ans)