n=int(eval(input()))

tmp=[['1',set({1})]]

for i in range(1,n):

  tmp2=[]

  for s,c in tmp:

    for j in range(len(c)+1):

      tmp2.append([s+str((j+1)%10),c|set({j+1})])

  tmp=tmp2

ans=[]

dic={'1':'a','2':'b','3':'c','4':'d','5':'e','6':'f','7':'g','8':'h','9':'i','0':'j'}

for s,c in tmp:

  ts=''

  for tc in s:

    ts+=dic[tc]

  ans.append(ts)

ans=sorted(ans)

for s in ans:

  print(s)
n=int(eval(input()))

dic={0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j'}

ans=[['a',1]]

for i in range(1,n):

  tmp=[]

  for prev,val in ans:

    for j in range(val+1):

      if j!=val:

        tmp.append([prev+dic[j],val])

      else:

        tmp.append([prev+dic[j],val+1])

  ans=tmp

ans=sorted(ans,key=lambda x:x[0])

for i in range(len(ans)):

  print((ans[i][0]))
n = int(eval(input()))
tmp = [["1", set({1})]]
for i in range(1, n):
    tmp2 = []
    for s, c in tmp:
        for j in range(len(c) + 1):
            tmp2.append([s + str((j + 1) % 10), c | set({j + 1})])
    tmp = tmp2
ans = []
dic = {
    "1": "a",
    "2": "b",
    "3": "c",
    "4": "d",
    "5": "e",
    "6": "f",
    "7": "g",
    "8": "h",
    "9": "i",
    "0": "j",
}
for s, c in tmp:
    ts = ""
    for tc in s:
        ts += dic[tc]
    ans.append(ts)
ans = sorted(ans)
for s in ans:
    print(s)

n = int(eval(input()))
dic = {0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h", 8: "i", 9: "j"}
ans = [["a", 1]]
for i in range(1, n):
    tmp = []
    for prev, val in ans:
        for j in range(val + 1):
            if j != val:
                tmp.append([prev + dic[j], val])
            else:
                tmp.append([prev + dic[j], val + 1])
    ans = tmp
ans = sorted(ans, key=lambda x: x[0])
for i in range(len(ans)):
    print((ans[i][0]))

-tmp = [["1", set({1})]] +dic = {0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h", 8: "i", 9: "j"} +ans = [["a", 1]] -    tmp2 = [] -    for s, c in tmp: -        for j in range(len(c) + 1): -            tmp2.append([s + str((j + 1) % 10), c | set({j + 1})]) -    tmp = tmp2 -ans = [] -dic = { -    "1": "a", -    "2": "b", -    "3": "c", -    "4": "d", -    "5": "e", -    "6": "f", -    "7": "g", -    "8": "h", -    "9": "i", -    "0": "j", -} -for s, c in tmp: -    ts = "" -    for tc in s: -        ts += dic[tc] -    ans.append(ts) -ans = sorted(ans) -for s in ans: -    print(s) +    tmp = [] +    for prev, val in ans: +        for j in range(val + 1): +            if j != val: +                tmp.append([prev + dic[j], val]) +            else: +                tmp.append([prev + dic[j], val + 1]) +    ans = tmp +ans = sorted(ans, key=lambda x: x[0]) +for i in range(len(ans)): +    print((ans[i][0]))