def cur(n):

    if ans[n]!=[]: return ans[n]

    for x in cur(n-1):

        tmp1=[0]+[x[i] for i in range(n-1)]

        tmp2=[0]+[x[i]+1 for i in range(n-1)]

        ans[n].append(tmp1)

        ans[n].append(tmp2)

        if max(x)!=0:

            for k in range(1,max(x)+1):

                tmp3=[0]+[x[i] for i in range(n-1)]

                for i in range(1,n):

                    if tmp3[i]==k: tmp3[i]=0

                    elif tmp3[i]<k: tmp3[i]+=1

                ans[n].append(tmp3)

    

    return ans[n]



def pri(x):

    s=""

    for i in range(p):

        s+=chr( ord("a")+x[i] )

    print(s)



p=int(eval(input()))

ans=[[] for i in range(11)]

ans[1]=[[0]]

ans[2]=[[0,0],[0,1]]

cur(p)



ans[p].sort()

pri(ans[p][0])

for i in range(1,len(ans[p])):

    if ans[p][i]!=ans[p][i-1]: pri(ans[p][i])

n=int(eval(input()))

def cur(x):

    if len(x)==n:

        s="".join([chr( ord("a")+x[i]) for i in range(n)])

        print(s)



    else:

         for i in range(max(x)+2):

             cur(x+[i])



cur([0])
def cur(n):
    if ans[n] != []:
        return ans[n]
    for x in cur(n - 1):
        tmp1 = [0] + [x[i] for i in range(n - 1)]
        tmp2 = [0] + [x[i] + 1 for i in range(n - 1)]
        ans[n].append(tmp1)
        ans[n].append(tmp2)
        if max(x) != 0:
            for k in range(1, max(x) + 1):
                tmp3 = [0] + [x[i] for i in range(n - 1)]
                for i in range(1, n):
                    if tmp3[i] == k:
                        tmp3[i] = 0
                    elif tmp3[i] < k:
                        tmp3[i] += 1
                ans[n].append(tmp3)
    return ans[n]


def pri(x):
    s = ""
    for i in range(p):
        s += chr(ord("a") + x[i])
    print(s)


p = int(eval(input()))
ans = [[] for i in range(11)]
ans[1] = [[0]]
ans[2] = [[0, 0], [0, 1]]
cur(p)
ans[p].sort()
pri(ans[p][0])
for i in range(1, len(ans[p])):
    if ans[p][i] != ans[p][i - 1]:
        pri(ans[p][i])

n = int(eval(input()))


def cur(x):
    if len(x) == n:
        s = "".join([chr(ord("a") + x[i]) for i in range(n)])
        print(s)
    else:
        for i in range(max(x) + 2):
            cur(x + [i])


cur([0])

-def cur(n): -    if ans[n] != []: -        return ans[n] -    for x in cur(n - 1): -        tmp1 = [0] + [x[i] for i in range(n - 1)] -        tmp2 = [0] + [x[i] + 1 for i in range(n - 1)] -        ans[n].append(tmp1) -        ans[n].append(tmp2) -        if max(x) != 0: -            for k in range(1, max(x) + 1): -                tmp3 = [0] + [x[i] for i in range(n - 1)] -                for i in range(1, n): -                    if tmp3[i] == k: -                        tmp3[i] = 0 -                    elif tmp3[i] < k: -                        tmp3[i] += 1 -                ans[n].append(tmp3) -    return ans[n] +n = int(eval(input())) -def pri(x): -    s = "" -    for i in range(p): -        s += chr(ord("a") + x[i]) -    print(s) +def cur(x): +    if len(x) == n: +        s = "".join([chr(ord("a") + x[i]) for i in range(n)]) +        print(s) +    else: +        for i in range(max(x) + 2): +            cur(x + [i]) -p = int(eval(input())) -ans = [[] for i in range(11)] -ans[1] = [[0]] -ans[2] = [[0, 0], [0, 1]] -cur(p) -ans[p].sort() -pri(ans[p][0]) -for i in range(1, len(ans[p])): -    if ans[p][i] != ans[p][i - 1]: -        pri(ans[p][i]) +cur([0])