peterverebics/CodeNet_Python_118 huggingface dataset:
li = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = int(input())
ans = ['a']
for i in range(1,n):
    ans_new = []
    for j in range(len(ans)):
        s = ans[j]
        ma = 0
        for l in range(len(s)):
            ma = max(ma,li.index(s[l]))
        for k in range(ma+2):
            ans_new.append(s+li[k])
    ans = ans_new
for a in ans:
    print(a)
# -*- coding:utf-8 -*-
import itertools


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

    if N==1:
        print("a")
        return

    anss = []

    def _dfs(d, _max, ans):
        if d==N:
            anss.append(ans)
            return

        for i in range(ord("a"), _max+2):
            _dfs(d+1, max(_max, i), ans+chr(i))

    _dfs(1, ord("a"), "a")

    anss.sort()

    for ans in anss:
        print(ans)


if __name__ == "__main__":
    solve()
from collections import deque

S = "abcdefghij"
N = int(input())
d = deque([("a", 1, 1)])
while(len(d)>0):
    tmp = d.pop()
    if tmp[1] < N:
        for i in range(tmp[2] + 1):
            tmp2 = (tmp[0] + S[i], tmp[1] + 1, max(tmp[2], i + 1))
            d.appendleft(tmp2)
    else:
        print(tmp[0])
def main():
    from string import ascii_lowercase
    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(input())
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            print(s)
            return
        else:
            for i in range(mx+2):
                v = s + dic[i]
                mx = max(mx, i)
                dfs(v, mx)
    dfs("a", 0)


if __name__ == '__main__':
    main()
from string import ascii_lowercase as alps

n = int(input())

def solve(x=n, c=0, l=[]):
    if x == 0:
        print(''.join(alps[i-1] for i in l))
        return

    x -= 1

    for nc in range(1, c + 1):
        solve(x, c, l + [nc])

    solve(x, c+1, l + [c+1])

solve()
def solve(x):
    if len(x) == n:
        ans.append(x)
        return 0
    syurui = len(set(x))
    for i in range(syurui + 1):
        solve(x + chr(97 + i))


n = int(input())

a = "a"

ans = []

solve(a)

ans = sorted(ans)

print(*ans)
n = int(input())
def dfs(s,c):
    if len(s)==n:
        print(s)
        return
    for i in range(ord("a"),ord(c)+2):
        if i>ord(c):
            dfs(s+chr(i),chr(i))
        else:
            dfs(s+chr(i),c)

dfs("a","a")
import sys, math

n = int(sys.stdin.readline().strip())

prev = ["a"]
cands = "abcdefghijklmnopqrstuvwxyz"
for i in range(1, n):
    current = []
    
    for one in prev:
        count = len(set(list(one)))
        for j in range(count+1):
            current.append(one + cands[j])
    prev = current

for one in prev:
    print(one)
N = int(input())
s = 'abcdefghij'

def dfs(word, n):
    if len(word)==N:
        print(word)
    else:
        for i in range(n+1):
            dfs(word+s[i], n+1 if i==n else n)
dfs('a', 1)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(input())
char = "".join(chr(97+i) for i in range(n))

def dfs(s, idx):
    if len(s) == n:
        print(s)
    else:
        for i in range(idx):
            dfs(s+char[i], idx if i+1 != idx else idx+1)


dfs("a", 2)
n = int(input())
def f(l):
	return "".join([chr(x+97) for x in l])

ans = [[] for _ in range(n)]
ans[0] = [[0]]
for i in range(1, n):
	for a in ans[i-1]:
		for j in range(max(a)+2):
			ans[i].append(a+[j])

for a in ans[n-1]:
	print(f(a))
n = int(input())

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

ans = [[0]]

for i in range(n-1):
  new_ans = [
    i + [j]
    for i
    in ans
    for j
    in range(min(10, max(i) + 2))
  ]
  ans = new_ans

for i in ans:
  print("".join(d[j] for j in i))
N = int(input())

alphabets = "abcdefghij"

def call( n, string, limit):
  """stringに対してn回後ろに付与するとしたらどうなるか、リストで頂戴。
  limitまでの文字しか使っちゃダメたよ"""
  if n ==0 :
    return set([string])
  
  res = set()
  for char in alphabets[:limit]:
    # print(string+char)
    res |= call(n-1, string+char, limit)
  res |= call(n-1, string+alphabets[limit], limit+1)
  return res
  
for i in sorted(list(call(N-1, "a", 1))):
  print(i)
from collections import deque

N = int(input())

queue = deque()
queue.append((0,))
while queue:
    s = queue.popleft()
    if len(s) == N:
        print(''.join('abcdefghij'[i] for i in s))
        continue
    for i in range(max(s) + 2):
        queue.append(s + (i,))
N = int(input())
from string import ascii_letters

def dfs(s, mx):
    if len(s) == N:
        print(s)
    else:
        for i, c in enumerate(ascii_letters[:mx]):
            dfs(s + c, mx + 1 if i + 1 == mx else mx)

dfs("", 1)
N = int(input())
str = "abcdefghijklmnopqrstuvwxyz"
def dfs(s,mx):
    if len(s) == N:
        print(s)
    else:
        for c in str[:mx+1]:
            if c == str[mx]: dfs(s+c, mx+1)
            else: dfs(s+c, mx)
dfs("", 0)
N = int(input())
if N==1:
    print("a")
    exit()
def dfs(s,cnt):
    if len(s)==N:
        return s
    for i in range(cnt+1):
        if i==cnt:
            cnt+=1
        if dfs(s+chr(ord("a")+i),cnt)!=None:
            ans.append(dfs(s+chr(ord("a")+i),cnt))
ans=[]
dfs("a",1)
ans = sorted(ans)
print(*ans)
import collections
N = int(input())

S = "abcdefghij"
result = []
deq = collections.deque(["a"])

while deq:
    s = deq.popleft()
    if len(s) == N:
        result.append(s)
        continue
    else:
        for i in S[:len(set(s))+1]:
            deq.append(s + i)

print('\n'.join(result))
def solve(s):
    if len(s)==n:
        a.append(''.join(chr(c+97)for c in s))
        return
    for i in range(max(s)+2):
        solve(s+[i])
n=int(input())
a=[]
solve([0])
print(*a)
chr='abcdefghijklmnopqrstuvwxyz'
a=[0]*int(input())
while 1:
  print(''.join(chr[i]for i in a))
  if a==list(range(len(a))):break
  a[-1]+=1
  i=-1
  while a[i]-max(a[:i]+[0])>1:
    a[i]=0
    i-=1
    a[i]+=1
import copy

n = int(input())

l = ['a']
ans = []


def f(n, s, l):
    if n == 1:
        for c in l:
            ans.append(s+c)
        return

    n -= 1
    for c in l:
        if (s+c).count(l[-1]) == 0:
            f(n, s+c, l)
        else:
            ll = copy.deepcopy(l)
            ll.append(chr(ord(ll[-1])+1))
            f(n, s+c, ll)


f(n, "", l)
for ss in ans:
    print(ss)
from collections import deque
def main(): 
    n = int(input())
    dq = deque([])
    dq.append([0])
    for _ in range(n-1):
        l = len(dq)
        for __ in range(l):
            s = dq.popleft()
            ls = len(set(s))
            for i in range(ls+1):
                dq.append(s+[i])
    
    for s in dq:
        s = list(map(lambda x: chr(x+ord("a")),s))
        print("".join(s))
main()
ans =["a"]
n =int(input())
for i in range(1,n):
  plus=[]
  for s in ans:
    nn=0
    for h in range(len(s)):
      nn=max(nn,ord(s[h]))
    num=nn-ord("a")+1
    for j in range(num+1):
      plus.append(s+chr(ord("a")+j))
  ans = plus
ans.sort()
for ss in ans:print(ss)
n = int(input())

if n == 1:
    print('a')
    exit()

lst = ['a']
for i in range(n-1):
    new_lst = []
    for string in lst:
        num = ord(sorted(string)[-1])
        for j in range(ord('a'), num+2):
            new_lst.append(string+chr(j))
    lst = new_lst

for string in lst:
    print(string)
N = int(input())
def dfs(s):
  if len(s) == N:
    print(s)
    return
  for i in "abcdefghijklmnopqrstuvwxyz":
    dfs(s+i)
    if max(list(s)) == chr(ord(i)-1):
      return
dfs("a")
l = "abcdefghij"


def dfs(a, mx):
    if len(a) == n:
        print(a)
        return
    for i, s in enumerate(l):
        if i == mx+1:
            dfs(a+s, mx+1)
            break
        else:
            dfs(a+s, mx)


n = int(input())
dfs("a", 0)
n=int(input())
s='abcdefghij'
def f(string):
  r=[]
  for i in range(len(string)):
    m=0
    for j in string[i]:
      if ord(j)-97 > m:
        m=ord(j)-97
    for j in range(m+2):
      r.append(string[i] + s[j])
  return r
string=['a']
for i in range(n-1):
  string=f(string)
for a in string:
  print(a)
n = int(input())
r = ['a']
for _ in range(n - 1):
  t = []
  for s in r:
    t.append(s + chr(ord(max(s)) + 1))
    for c in set(s):
      t.append(s + c)
  r = t
print(*sorted(r), sep='\n')
def dfs(n, s, types):
    if(n==1):
        for i in range(types):
            c = chr(97+i)
            print(s+c)
    else:
        for i in range(types):
            c = chr(97+i)
            if(i==types-1):
                dfs(n-1, s+c, types+1)
            else:
                dfs(n-1, s+c, types)

N = int(input())
dfs(N, '', 1)
from string import ascii_lowercase as alph
from operator import itemgetter

def gen_pattern(N, pre=[]):
  for i in range(max(pre or [-1])+2):
    indexes = pre+[i]
    if len(indexes) == N:
      print("".join(itemgetter(*indexes)(alph)))
    else:
      gen_pattern(N, indexes)

gen_pattern(int(input()))
n = int(input())

a = ord('a')
reprs = [('a', a)]
for i in range(1, n):
    tmprep = []
    for r, l in reprs:
        for j in range(l-a+2):
            tmprep.append((r+chr(a+j), max(l, a+j)))
    reprs = tmprep



for r, l in reprs:
    print(r)
N = int(input())
dp = [[] for _ in range(N+1)]
dp[1] = [["a"]]
for i in range(2,N+1):
    for j in range(len(dp[i-1])):
        for k in range(len(set(dp[i-1][j]))+1):
            dp[i].append(dp[i-1][j]+[chr(97+k)])
ans = dp[N]
for i in range(len(ans)):
    print("".join(ans[i]))
import copy
from functools import reduce
alphabet = " abcdefghij"
def dfs(n, arr, cur):
  if cur == n:
    return print(reduce(lambda x, y:x+y, map(lambda x:alphabet[x], arr)))
  else:
    i = 1
    while i <= max(arr)+1:
      tmp = copy.copy(arr)
      tmp[cur] = i
      dfs(n, tmp, cur+1)
      i += 1

N = int(input())
dfs(N, [0]*N, 0)
N = int(input())
S = "abcdefghij"
ans = [""]
for k in range(N):
    n = []
    for e in ans:
        for f in S[:len(set(str(x) for x in e))+1]:
            n.append(e+f)
    ans = n
ans = sorted(ans)
for e in ans:
    print(e)
N = int(input())
cur = [('a', 0)]
for _ in range(N-1):
    new = []
    for s, c in cur:
        for i in range(c + 2):
            new.append((s + chr(ord('a') + i), max(i, c)))
    cur = new
for s, c in cur:
    print(s)
N = int(input())

def f(s, mx):
    if len(s) == N:
        print(s)
    else:
        for c in range(ord('a'), ord(mx) + 1):
            f(s + chr(c), chr(ord(mx) + 1) if c == ord(mx) else mx)
    
f("", 'a')
import sys
input = sys.stdin.readline

def main():

    S = ["a"]
    N = int(input())
    m = 97

    def add_str(S,m):
        if len(S)==N:
            print("".join(S))
        else:
            for j in range(97,m+2):
                add_str(S+[chr(j)], max(m,j))

    add_str(S,m)

if __name__ == '__main__':
    main()
abc = "abcdefghijklmnopqrstuvwxyz"
n = int(input())

ans = []


def f(s="", x=1):
    global ans
    if len(s) == n:
        ans.append(s)
        return 0
    for i in range(x):
        f(s + abc[i], max(x, i+2))


f()
ans.sort()
for i in ans:
    print(i)
n = int(input())


def dfs(s, mx):
    if len(s) == n:
        print(s)
        return
    for i in range(ord('a'), ord(mx) + 2):
        dfs(s + chr(i), max(mx, chr(i)))


dfs('a', 'a')
N = int(input())

def dfs(s, n):
    if len(s) == N:
        return [s]
    ret = []
    for i in range(n):
        ret += dfs(s + chr(i + ord('a')), n)
    ret += dfs(s + chr(n + ord('a')), n+1)
    return ret

for w in dfs('', 0):
    print(w)
def saiki(n,A):

    if n == N:
        A.sort()
        for i in A:
            print(i)
        return

    alpha = list("abcdefghijklmnopqr")

    tmp = []

    for i in A:
        a = alpha.index(sorted(list(i))[-1])
        for j in range(a+2):
            tmp.append(i+alpha[j])
    
    saiki(n+1,tmp)

N = int(input())

saiki(1,["a"])
n = int(input())
q = ['a']
for i in range(n-1):
   nq = []
   for s in q:
      stop = ord(max(s)) + 2
      for i in range(ord('a'), stop):
         nq.append(s + chr(i))
   q = nq

for s in q:
   print(s)
n = int(input())
al = "abcdefghijklmn"
s = [("a", 1)]
for i in range(n-1):
    ss = []
    for j in range(len(s)):
        for k in range(s[j][1]+1):
            ss.append((s[j][0] + al[k], s[j][1] + (k == s[j][1])))
    s = ss
for i in range(len(s)):
    print(s[i][0])
n=int(input())

al=["a","b","c","d","e","f","g","h","i","j"]

if n==1:
    print("a")
    exit()

#桁数がi
"""
[
    [[a]]
    [[aa],[ab]]
    [[aaa],[aba,abb],[abc]]
]


"""
result=[["a"]]
for i in range(n-1):
    temp=[]
    for item in result[i]:
        uniqAl=len(''.join(set(item)))
        for alp in al[:uniqAl+1]:
            temp.append(item+alp)
    result.append(temp)


for item in result[-1]:
    print(item)
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def dfs(s,mx,N):
    if len(s) == N:
        print(s)
    else:
        alpha = 'abcdefghijk'
        for c in range(mx+1):
            if c == mx:
                mx += 1
            dfs(s+alpha[c],mx,N)


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

    dfs('',0,N)



main()
n = int(input())

def dfs(s, mx):
    """
    :param s: 今の文字
    :param mx: 今までで最大の文字
    :return:
    """
    if len(s) == n:
        print(s)
        return
    for c in range(ord('a'), ord(mx) + 1 + 1):
        t = s
        t += chr(c)
        mx = chr(max(ord(mx), c))
        dfs(t, mx)

dfs('', chr(ord('a')-1))
def solve(li):
    if len(li) == n:
        ans.append(li)
        return
    tmp = max(li)
    for i in range(1, tmp + 2):
        solve(li + [i])

ans = []
n = int(input())
solve([1])
res = []
alph = "abcdefghijklmnopq"

for ptn in ans:
    for i in range(n):
        ptn[i] = alph[ptn[i] - 1]
    res.append("".join(ptn))
res = sorted(res)
for i in res:
    print(i)
n = int(input())

ans = []
def dfs(x):
    if len(x) == n:
        ans.append(x)
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])
#print(ans)

for ai in ans:
    print(''.join(map(lambda x: chr(ord('a') + x - 1), ai)))

#r = ['a','b','c','d','e','f','g','h','i','j']
#for ai in ans:
#    print(''.join(map(lambda x: str(r[x-1]), ai)))
a='a'
exec('a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];'*~-int(input()))
print(*a)
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N = int(input())
    
    def rec(n, maxchr, ans):
        if n==N-1:
            print(ans)
        else:
            for i in range(maxchr+1):
                # print(i)
                rec(n+1, maxchr, ans+chr(i+97))
            rec(n+1, maxchr+1, ans+chr(maxchr+98))

    rec(0, 0, 'a')

if __name__ == '__main__':
    resolve()
def dfs(s, mx) :
    if len(s) == n :
        print(s)
        return
    else:
        for i in range(ord('a'), mx+2) :
            t = s + chr(i)
            dfs(t, max(mx, i))

n = int(input())
dfs('a', ord('a'))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n = int(input())
char = "".join(chr(97+i) for i in range(n))


def dfs(s, idx):
    if len(s) == n:
        print(s)
    else:
        for i in range(idx):
            if i+1 != idx:
                dfs(s+char[i], idx)
            else:
                dfs(s+char[i], idx+1)


dfs("a", 2)
# https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_d
n = int(input())

def dfs(s, kinds):
    if len(s) == n:
        print(s) 
    else:
        for i in range(kinds+1):
            new_kinds = kinds + (1 if i == kinds else 0)
            dfs(s + chr(ord('a') + i), new_kinds)

dfs('', 0)
N = int(input())
a_ch = [chr(ch) for ch in range(ord('a'), ord('j') + 1)]

def DFS(s, mx):
  if len(s) == N:
    print(s)
  else:
    for i in range(mx + 1):
      if i == mx:
        DFS(s + a_ch[i], mx + 1)
      else:
        DFS(s + a_ch[i], mx)

DFS('', 0)
n = int(input())
a = [0]*n

def print_str():
    for i in reversed(a):
        print(chr(97+i), end='')
    print()

print_str()
while True:
    for i in range(n-1):
        if a[i] <= max(a[i+1:]):
            a[i] += 1
            for j in range(i):
                a[j] = 0
            print_str()
            break
    else:
        break
from collections import deque

d = {i:[] for i in range(1, 11)}
q = deque([(1, "a")])
while q:
    pos, s = q.popleft()
    if pos == 11:
        break
    d[pos].append(s)
    size = len(set(s))
    for i in range(size+1):
        q.append((pos+1, s+chr(97+i)))

N = int(input())
for i in d[N]:
    print(i)
N = int(input())

def dfs(ans, MAX):
    if len(ans) == N:
        print(ans)
        return
    for i in range(MAX-95):
        dfs(ans + chr(97+i), max(MAX, 97+i))

dfs('a', 97)
def dfs(s, mx):
    if len(s) == N:
        print(s)
        return
    for c in range(ord("a"), mx + 1):
        dfs(s + chr(c), mx + 1 if c == mx else mx)

if __name__ == "__main__":
    N = int(input())
    dfs("", ord("a"))
import sys
sys.setrecursionlimit(10**8)

n = int(input())

def dfs(s, mx):
    if len(s) == n:
        print(s)
        return
    for i in range(ord('a'), mx + 2):
        t = s
        t += chr(i)
        mxc = mx
        mxc = max(mxc, i)
        dfs(t, mxc)
    return


mx = ord('a')
dfs('a', mx)
N = int(input())


def DFS(N, S):
    if len(S) == N:
        print(S)
    else:
        next_chrs = []
        if S:
            next_max_chr = ord(max(S)) + 1
        else:
            next_max_chr = ord("a")
        for i in range(0, next_max_chr - ord("a") + 1):
            DFS(N, "".join([S, chr(ord("a") + i)]))


DFS(N, "")
def main():
    n = int(input())
    def dfs(s, c):
        chars = 'abcdefghijklmnop'
        if len(s) == n:
            print(s)
            return
        for i in range(c):
            dfs(s+chars[i], c)
        dfs(s+chars[c], c+1)
    dfs("", 0)

main()
n = int(input())

def dfs(s, mx):
    if len(s) == n:
        print(s)
        return
    else:
        for i in range(ord("a"), ord(mx)+2):
            t = s
            t += chr(i)
            dfs(t, max(chr(i), mx))

dfs("a", chr(ord("a")))
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
INF = 500000
mod = 10**9+7

cs = atoz = [chr(i) for i in range(97,97+10)]

N = int(input())

def Str(i, m, S):
    if i == N:
        print(S)
        return
    for c in cs[:m]:
        Str(i+1, m, S+c)
    Str(i+1, m+1, S+cs[m])

Str(0, 0, '')
from collections import deque
n=int(input())

alpha=list('abcdefghijk')

q=deque([])
q.append(alpha[0])

for i in range(1,n):
    qi=deque([])

    while(len(q)>0):
        qij=q.popleft()
        qij_setnum=len(set(list(qij)))
        for j in range(qij_setnum+1):
            qi.append(qij+alpha[j])

    q=qi

q=list(q)
q.sort()
for i in range(len(q)):
    print(q[i])
from string import ascii_lowercase as alphabets


N = int(input())


def dfs(s, used):
    if len(s) == N:
        print(s)
        return
    for i in range(used+2):
        t = s
        t += alphabets[i]
        dfs(t, max(used, i))


dfs("a", 0)
import sys
sys.setrecursionlimit(10 ** 6)


N = int(input())
ans = []
a = ord('a')


def dfs(S, mx):
    global N
    if len(S) == N:
        ans.append(S)
    else:
        for c in range(0, mx + 2):
            dfs(S + chr(c + a), max(mx, c))


dfs('a', 0)
print(*ans, sep='\n')
N = int(input())
alp="abcdefghijk"

s = "a"
def dfs(s,n,alp):
  if len(s) == n:
    print(s)
  else:
    for i in range(max([alp.find(s[i]) for i in range(len(s))])+2):
      s = s + alp[i]
      dfs(s,n,alp)
      s = s[:-1] 
dfs(s,N,alp)
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
d = 'abcdefghij'
x = ['a']
cnt = 1

while cnt<N:
    y = []
    for i in x:
        for j in d[:len(set(i))+1]:
            y.append(i+j)
    x = y
    cnt += 1
print('\n'.join(x))
K = int(input())-1
al = [chr(i) for i in range(97, 97+26)]
S_arr = [al[0]]
for i in range(K):
  new_S_arr = []
  for S in S_arr:
    for j in range(len(set(list(S)))+1):
      new_S_arr.append(S + al[j])
  S_arr = new_S_arr

for S in S_arr:
  print(S)
N = int(input())
alph = {'a':'b','b':'c','c':'d','d':'e','e':'f','f':'g','g':'h','h':'i','i':'j','j':'k'}
result = ['a']
for i in range(N-1):
    s = []
    for j in result:
        for k in range(len(j)):
            s.append(j+j[k])
        s.append(j+alph[max(j)])
    result = s

result = list(set(result))
result.sort()
for j in result:
    print(j)
N = int(input())

answer = [(97, 'a')]
for _ in range(N - 1):
    new_answer = []
    for i, j in answer:
        for k in range(97, i + 1):
            new_answer.append((i, j + chr(k)))
        new_answer.append((i+1,j+chr(i+1)))
    answer = new_answer[:]

answer = [j for _, j in answer]
answer.sort()
print('\n'.join(answer))
n = int(input())
def dfs(x):
    if len(x) == n:
        print(''.join(map(lambda i: chr(ord('a') + i - 1), x)))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(max(s)) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)
def recursion(s, mx, n):
    if len(s) == n:
        print(s)
        return
 
    c = 'a'
    while c <= mx:
        nmx = mx
        if c == mx:
            nmx = chr(ord(c) + 1)
        recursion(s + c, nmx, n)
        c = chr(ord(c) + 1)


n = int(input())
recursion("", 'a', n)
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

    def dfs(s, num):
        if len(s) == n:
            print(s)
            return

        for i in range(num + 1):
            t = s + chr(97 + i)
            dfs(t, max(num, i + 1))

    dfs("", 0)


if __name__ == '__main__':
    resolve()
def mm(a):
  x = 0
  for i in range(0,len(a)):
    if x < ord(a[i]):
      x = ord(a[i])

  return x

n = int(input())
ans = ["a"]
 
for i in range(0,len(ans)):
  while len(ans[i]) < n:
    k = mm(ans[i])
    for j in range(97,k+2):
      ans.append(ans[i] + chr(j))
    del ans[i]
 
sorted(ans)
for i in range(0,len(ans)):
  print(ans[i])
n=int(input())
def d(s):
    if len(s)==n:
        print(s)
    else:
        for i in range(97,ord(max(s))+2):
            d(s+chr(i))
d("a")
import sys

sys.setrecursionlimit(100000)


def dfs(s, mx):
    if len(s) == N:
        print(s)
        return 0
    for c in range(ord("a"), mx + 2):
        t = s
        t += chr(c)
        dfs(t, max(mx, c))


N = int(input())
dfs("", ord("a") - 1)
N = int(input())
S = [['a',1]]
import copy

for i in range(N-1):
    tmp = []
    for j in S:
        s = j[0]
        n = j[1]
        for k in range(n+1):
            tmp.append([''.join([s,chr(k+97)]), max(n,k+1)])
    S = copy.deepcopy(tmp)
for i in S:
    s = i[0]
    print(s)
n = int(input())


def dfs(n, s, idx):
    l = len(s)
    if n == l:
        print(s)
        return
    alpha = "abcdefghijklmnopqrstuvwxyz"
    i = 0
    while i < idx + 1:
        if i == idx:
            dfs(n, s + alpha[i], idx + 1)
        else:
            dfs(n, s + alpha[i], idx)
        i += 1


dfs(n, "", 0)
n = int(input())

al = [chr(ord('a') + i) for i in range(26)]

def dfs(idx, tmp):
    if idx == n:
        return [tmp]
    else:
        ret = []
        nexts = list(set(list(tmp)))
        nexts.sort()
        nexts.append(chr(ord(nexts[-1]) + 1))
        for x in nexts:
            ret += dfs(idx + 1, tmp + x)
        return ret

ans = dfs(1, 'a')
ans.sort()
for a in ans:
    print(a)
n=int(input())
from collections import deque
def dfs():
  todo=deque([[1]])
  ret=[]
  while len(todo)>0:
    t=todo.popleft()
    if len(t)==n:
      ret.append(t)
    else:
      l=max(t)+1
      for i in range(l):
        tc=t.copy()
        tc.append(i+1)
        todo.append(tc)
  return ret
a=dfs()
n2a = lambda c: chr(c+64).lower()
for ai in a:
  #print(ai)
  print(''.join(map(n2a,ai)))
def dfs(word, i):
    if len(word) == n:
        print(word)
    else:
        if i == 0:
            dfs('a', 1)
        else:
            for j in range(len(set(word)) + 1):
                dfs(word + chr(97 + j), j + 1)


if __name__ == "__main__":
    n = int(input())

    dfs('', 0)