peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
input = sys.stdin.readline

n = int(input())

def rec(s, kind):
    if len(s) == n:
        print(s)
        return
    for i in range(kind+1):
        end = chr(ord('a')+i)
        if i < kind:
            rec(s+end, kind)
        else:
            rec(s+end, kind+1) 

rec('a', 1)
n = int(input())

hyo = [[[1]]]

for i in range(n-1):
    n_hyo = []
    for arr in hyo[i]:
        for j in range(max(arr)+1):
            n_arr = arr[:]
            n_arr.append(j+1)
            n_hyo.append(n_arr)
    hyo.append(n_hyo)

alp = ['a','b','c','d','e','f','g','h','i','j']

for i in hyo[n-1]:
    ans = ''
    for j in i:
        ans += alp[j-1]
    print(ans)
n = int(input())

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        for i in range(mx + 1):
            c = chr(ord('a') + i)
            if i == mx:
                dfs(s+c, mx+1)
            else:
                dfs(s+c, mx)
dfs('', 0)
alf = 'abcdefghijklmnopqrstuvwxyz'
d = {c:i+1 for i,c in enumerate(alf)}
d['z']=25
def dfs(n):
    lst = []
    lst.append([['a'],0])
    while lst:
        a,mx = lst.pop()
        if len(a) == n:
            print(''.join(a))
            continue
        for i in range(min(mx+1,25)+1)[::-1]:
            lst.append([a + [alf[i]], max(i,mx)])

n= int(input())
dfs(n)
n = int(input())

q = ['a']
for i in range(n-1):
    nq=[]
    for j in q:
        stop=ord(max(j))+2

        for k in range(ord('a'),stop):
            nq.append(j+chr(k))
        q=nq

for i in q:
    print(i)
N = int(input())

def aa(s, n, t):
    if n == N:
        print(s)
        return
    for i in range(t):
        aa(s+chr(97+i), n+1, t)
    aa(s+chr(97+t), n+1, t+1)
    return


aa("a", 1, 1)
n = int(input())
res = []

def f(frm, l, head):
    if l == 0:
        res.append(head)
    for i in range(l, 0, -1):
        for j in range(frm):
            f(frm, l - i, head + chr(ord('a') + j) * i)
        f(frm + 1, l - i, head + chr(ord('a') + frm) * i)
    
f(0, n, '')
print(*sorted(list(set(res))), sep='\n')
n = int(input())

alphas = "abcdefghij"
init_str = ""

def standard(moji, i):
    if len(moji) == n:
        print(moji)
    else:
        for j in range(i):
            if j == i - 1:
                standard(moji + alphas[j], i + 1)
            else:
                standard(moji + alphas[j], i)
                

standard(init_str, 1)
al=[chr(ord('a') + i) for i in range(26)]
N=int(input())
ans=[[] for _ in range(N)]
ans[0].append("a")

if N==1:
  print("a")
else:
  for i in range(1,N):    
    for item in ans[i-1]:
      lis=list(item)
      st=set(lis)
      for j in range(len(st)+1):
        ans[i].append(item +chr(ord('a') + j))
  for answer in ans[-1]:
    print(answer)
N = int(input())

All = []
def enumeration(a="0", b = 1):
    if len(a) == N:
        All.append(a)
    else:
        for i in range(len(set(a)) + 1):
            enumeration(a + str(i), b+1)

enumeration()
for i in range(len(All)):
    All[i] = list(All[i])
    for p in range(len(All[i])):
        All[i][p] = chr(97 + int(All[i][p]))
    print("".join(All[i]))
N = int(input())

tmp = "abcdefghij"

ans = ""

i = 1


def mkstr(ans, i):
    if len(ans) >= N:
        print(ans)
    else:
        for j in range(i):
            if j == i - 1:
                mkstr(ans + tmp[j], i + 1)
            else:
                mkstr(ans + tmp[j], i)


mkstr(ans, i)
n = int(input())
alp = [chr(ord("a") + x) for x in range(26)]

def dfs(S):
    if len(S) == n:
        print(S)
    else:
        max_s = ord(max(S)) - 96
        #print(max_s)
        for i in range(max_s + 1):
            dfs(S + alp[i])

dfs("a")
n = int(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):
            tmp.append([prev+dic[j],val]) if 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])
ALPHA = 'abcdefghij'
N = int(input())
ans = [('', 0)]
for _ in range(N):
    temp = []
    for s, num in ans:
        for a in ALPHA[:num]:
            t = s + a
            temp.append((t, num))
        temp.append((s + ALPHA[num], num + 1))
    ans = temp
for a, _ in ans: print(a)
def dfs(s, ub, n):
    if len(s) == n:
        print(s)
    else:
        ch = "a"
        while ord(ch) < ord(ub):
            dfs(s + ch, ub, n)
            ch = chr(ord(ch) + 1)
        ub = chr(ord(ub) + 1)
        dfs(s + ch, ub, n)

def solve(n):
    dfs("", "a", n)

n = int(input())
solve(n)
n = int(input())


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

    for c in range(ord('a'), mx + 1 + 1):
        dfs(s + chr(c), max(mx, c))


dfs("", ord('a') - 1)
n=int(input());s=['a']
while len(s)>0:
  t=s.pop(-1)
  if len(t)==n:print(t)
  else:
    a=max(ord(i)for i in t)
    for a in range(a+1,96,-1):s.append(t+chr(a))
from string import ascii_lowercase
def main():
    n=int(input())
    Ans=['a']
    A=ascii_lowercase
    for i in range(n-1):
        Tmp=[]
        for a in Ans:
            s=set(list(a))
            for l in A:
                Tmp.append(a+l)
                if l not in s:
                    break
        Ans=Tmp[:]
    for ans in Ans:
        print(ans)
    
if __name__=='__main__':
    main()
n = int(input())
a = "abcdefghijklmmopkrstuvwxyz"


def solve(s, m):
    if len(s) == n:
        print(s)
        return
    for v in a:
        if ord(v)-m <= 1:
            solve(s+v, max(m, ord(v)))


solve("a", ord("a"))
n=int(input())

abc='abcdefghij'

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

  st_l=len(set(s))
  for i in range(st_l+1):
    dfs(s+abc[i])

dfs('a')
n = int(input())

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        m = ord(mx) - ord("a")
        for i in range(m+1):
            c = chr(i + ord("a"))
            if c == mx:
                dfs(s + c, chr(ord(mx)+1))
            else:
                dfs(s + c, mx)

dfs("", "a")
import sys
sys.setrecursionlimit(500000)

N = int(input())
global ans
ans = []
def dfs(now,rank,root_,m):
    root = root_[:]
    if rank == N:
        root.append(now)
        ans.append(''.join([chr(i+ord('a')) for i in root]))
    else:
        root.append(now)
        for i in range(m+2):
            dfs(i,rank+1,root,max(m,i))

dfs(0,1,[],0)
ans.sort()
print(*ans,sep='\n')
def dfs(s,x):
    if len(s) == n:
        print(s)
    else:
        for c in range(ord('a'), ord(x) + 1):
            dfs(s + chr(c), chr(ord(x) + 1) if chr(c) == x else x)

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

def f(s, c):
  if len(s)>=N:
    print s
  else:
    for i in range(c+1):
      f(s+chr(ord("a")+i), max(i+1, c))
f("", 0)
import sys
def input(): return sys.stdin.readline().rstrip()
def dfs(s,mxs):
    if len(s)==n:
        print(s)
    else:
        for i in range(ord('a'),ord(mxs)+1):
            dfs(s+chr(i),chr(i+1) if i ==ord(mxs) else mxs)

def main():
    global n
    n=int(input())
    dfs('','a')
    

if __name__=='__main__':
    main()
n = int(input())
a = [ [] for _ in range(11) ]
a[0].append("a")

alp = "abcdefghijklmn"
for i in range(1, 10):
    for aa in a[i-1]:
        for c in alp[:i+1]:
            max_e = max( [ord(x) for x in aa] )
            if max_e+1 < ord(c): break
            a[i].append(aa+c)

for ans in a[n-1]:
    print(ans)
from collections import deque

N = int(input())

d = deque()

d.append(([],0,-1))
dlen = 1
while dlen != 0:
    arr,le,ma = d.popleft()
    dlen -= 1
    if le == N:
        for a in arr:
            print('abcdefghij'[a],end='')
        print('')
        continue
    for i in range(ma+2):
        aarr = arr + [i]
        lle = le + 1
        mma = max(ma,i)
        d.append((aarr,lle,mma))
        dlen += 1
N = int(input())


Z = 'abcdefghijklmn'
def solve(N):
    if N == 1:
        return [(1, "a")]
    result = []
    for n, s in solve(N-1):
        for i in range(n+1):
            result.append((max(n, i+1), s+Z[i]))
    return result

for s in sorted(s for i, s in solve(N)):
    print(s)
import sys
sys.setrecursionlimit(1000000000)
n=int(input())
al=[chr(ord('a') + i) for i in range(15)]
def dfs(c,i):
    if i==n:
        print(c)
        return
    p=0
    for k in c:
        p=max(p,ord(k))
    for k in range(p-ord('a')+2):
        dfs(c+al[k],i+1)
dfs("a",1)
def dfs(s,x):
    if len(s) == n:
        print(s)
    else:
        for c in range(ord('a'),ord(x) + 1):
            dfs(s + chr(c),chr(ord(x) + 1) if chr(c) == x  else x)

n = int(input())
dfs("",'a')
n = int(input())
a = list(chr(i*97) for i in range(10))
ans = 'a'

def dfs():
    global ans, n
    if len(ans) == n:
        print(ans)
    else:
        max1 = 'a'
        for i in range(len(ans)):
            max1 = max(max1, ans[i])
        for i in range(ord(max1) - 95):
            ans += chr(i+97)
            dfs()
            ans = ans[:-1]

dfs()
import sys
from copy import copy
sys.setrecursionlimit(10**6)

#文字(数列)、最大数、何文字目か0からn-1、ゴールn n-1になったらプリント
def p(s,m,i,last):
    # a=97
    if i==last-1:
        print("".join([chr(97+j)for j in s]))
        return
    for k in range(m+2):
        S=copy(s)
        S.append(k)
        p(S,max(m,k),i+1,last)

def main():
    n=int(input())
    s=[0]
    p(s,0,0,n)

main()
#!/usr/bin/env python3

num = int(input())
alf = ['a','b','c','d','e','f','g','h','i','j','k']
def dfs(s, mx_idx):
    if len(s) == num:
        print(s)
        return
    for i in range(mx_idx+1):
        if i == mx_idx:
            dfs(s+alf[i], mx_idx+1)
        else:
            dfs(s+alf[i], mx_idx)

dfs('', 0)
N = int(input())
def DFS(s, mx):
    if len(s) == N:
        print(s)
        return
    c = 'a'
    while c <= chr(ord(mx)+1):
        t = s + c
        DFS(t, chr(max(ord(c), ord(mx))))
        c = chr(ord(c) + 1)
DFS("", chr(ord('a')-1))
import sys
N = int(input())

alphabets = [chr(ord('a') + x) for x in range(10)]

def dfs(S, i):
    if len(S) == N:
        yield ''.join(S)
        return
    for j in range(i):
        for w in dfs(S + [alphabets[j]], i):
            yield w
    for w in dfs(S + [alphabets[i]], i + 1):
        yield w

for w in dfs([],0):
    print(w)
N = int(input())

arr=[1]*N


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

def num2alpha(num):
    return chr(num+96)

def keta(num):
    if(arr[num-1]<arr[num]):
        keta(num-1)
    else:
        for k in range(num+1,N):
            arr[k] = 1
        arr[num] += 1
        


i = N-1
while arr[0]==1:
    ans = map(num2alpha,arr)
    print((''.join(ans)))
    keta(N-1)
import sys

N = int(sys.stdin.readline().strip())
alpha = "abcdefghij"

tmp = ["a"] * N
print("".join(tmp))
for i in range(1, N):
    for j in range(0, N - i):
        tmp[N-j-1] = alpha[i]
        print("".join(tmp))
n = int(input())
print("a"*n)
c = "a"
if n > 1:
    for i in range(1,n):
        c += chr(ord("a") + (i))
    print(c)
chars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
N = int(input())

def solve(s = "", depth = 0):
  if len(s) == N:
    print(s)
    return
  
  for i in range(depth + 1):
    solve(s + chars[i], depth + 1)

solve()
num = int(input())
base = ["a","b","c","d","e","f","g","h","j","k"]

if num == 1:
  print("a")
elif num == 2:
  print("aa")
  print("ab")
elif num == 3:
  print("aaa")
  print("aab")
  print("aba")
  print("abb")
  print("abc")
elif num == 4:
  print("aaaa")
  print("aaab")
  print("aaba")
  print("aabb")
  print("aabc")
  print("abaa")
  print("abab")
  print("abac")
  print("abba")
  print("abbb")
  print("abbc")
  print("abca")
  print("abcb")
  print("abcc")
  print("abcd")
#!/usr/bin/env python


def plse1(s, i):
    if i == 0:
        return s
    if s[i] > s[i - 1]:
        s = plse1(s, i - 1)
        s[i] = 0
    else:
        s[i] += 1
    return s


n = int(input())
ss = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

s = [0] * n
while True:
    string = ''
    for i in range(n):
        string += ss[s[i]]
    print(string)
    s = plse1(s, n - 1)
    if s == [0] * n:
        break
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

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

n = ni()

import numpy as np

for i in range(2**(n-1)):
  k = list(map(int,format(i, 'b')))
  u = len(k)
  k = [0]*(n-u) + k
  p = list(np.cumsum(k))
  ans = [str(al[j])for j in p]
  print(''.join(ans))
def dfs(n, i, s):
    global ans
    s += chr(i)
    if n == N:
        ans += [s]
        return
    for ii in range(97, i+2):
        dfs(n+1, ii, s)

N = int(input())
i = 97
ans = []
dfs(1, 97, '')
ans = sorted(ans)
for a in ans:
    print(a)
from string import ascii_lowercase
n = int(input())
d = {s: i for i, s in enumerate(ascii_lowercase)}
a = [s for s, i in d.items()]
ans = []

def dfs(k, s):
    if n == k:
        ans.append(s)
    elif n > k:
        for i in range(max([d[c] for c in s])+2):
            v = s + a[i]
            dfs(k+1, v)
dfs(1,"a")
ans.sort()
for k in ans:
    print(k)
print('\n')
N=int(input())

ans='a'*N
ans_code=[0]*N
for i in range(N):
    ans_code[i]=ord(ans[i])
#print(ans_code)

for k in ans_code:
        print(chr(k),end='')
print('')

for i in range(1,N):
    for j in range(1,i+1):
        ans_code[-j]+=1
    #print(ans_code)
    for k in ans_code:
        print(chr(k),end='')
    print('')
    

"""
ans[-1]
for i in range(N):
    ans[]
"""
from copy import deepcopy
def main():
    N = int( input())
    if N == 1:
        print('a')
        return
    ANS = ['a']
    for _ in range(N-1):
        G = deepcopy(ANS)
        ANS = []
        for t in G:
            ANS.append(t+'a')
            ANS.append(t+'b')
    print('\n'.join(ANS))
if __name__ == '__main__':
    main()
n = int(input())
alp = [chr(ord("a") + x) for x in range(26)]

def dfs(S):
    if len(S) == n:
        print(S)
    else:
        for i in range(len(S) + 1):
            dfs(S + alp[i])

dfs("a")
import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np


def main():
	n=int(input())
	s="abcdefghijklmn"

	li=[[] for _ in range(10)]
	li[0]="a"

	for i in range(1,10):
		for t in li[i-1]:
			for j in range(i+1):
				if s[j]=="a" or ord(t[-1])<=ord(s[j])<=ord(t[-1])+1:
					li[i].append(t+s[j])

	for i in li[n-1]:
		print(i)


if __name__ == "__main__":
	main()
n=int(input())
l=[['a1']]+[[] for _ in range(9)]
for i in range(9):
  for b in l[i]:
    t=b[-1]
    for p in range(int(t)):
      l[i+1].append(b[:-1]+chr(97+p)+t)
    l[i+1].append(b[:-1]+chr(97+int(t))+str(int(t)+1))
for i in l[n-1]:
  print(i[:-1])
from itertools import combinations_with_replacement
n=int(input())
L='abcdefghij'
Li=L[:n]
kumiawase=list(combinations_with_replacement(Li, n))
for kumi in kumiawase:
    print(''.join(kumi))
n = int(input())
cs = 'abcdefghijklmn'
cm = {cs[i]:i for i in range(len(cs))}

def rec(string, l):
    if (l >= n):
        print(string)
        return 0
    now = string[-1]
    k = max(cm[string[i]]+1 for i in range(len(string)))
    k = max(k, cm[now] + 2)
    for c in cs[:k]:
        rec(string + c,l+1)

rec('a',1)
N = int(input())

alphabet = ['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']

def norm(n, prev_list):
	out_list = []
	for line in prev_list:
		for i in range(len(set(line))+1):
			new_line = line + alphabet[i]
			out_list.append(new_line)
	return out_list

init_line = ['a']

for _ in range(N-1):
	init_line = norm(1, init_line)

print(init_line)
n = int(input())
ans = []
start = "a"
stack = []
stack.append(start)
num = ord("a")
while stack:
    v = stack.pop()
    if len(v) == n:
        ans.append(v)
        continue
    nex_num = ord(v[-1])
    for i in range(num, nex_num + 2):
        tuika = chr(i)
        stack.append(v + tuika)
ans.sort()
print(*ans, sep="\n")
n = int(input())
ans = ['a']
for j in ans:
  if len(j) < n:
    c = ord(j[-1])
    #print(c)
    for i in range(97,c+2):
      l = str(j + chr(i))
      ans.append(l)
chk = []
for i in ans:
  if len(i) == n:
    chk.append(i)
for i in chk:
  print(i)
n = int(input())
ans = []
start = "a"
stack = []
stack.append(start)
num = ord("a")
while stack:
    v = stack.pop()
    if len(v) == n:
        ans.append(v)
        continue
    nex_num = ord(v[-1])
    for i in range(num, nex_num + 2):
        tuika = chr(i)
        stack.append(v + tuika)

print(*ans[::-1], sep="\n")
import itertools
n = int(input())
li = list(itertools.product([0,1], repeat=n))
alp = list('abcdefghijklmnopqrstuvwxyz')

ans_li = ['0']
for _ in range(n-1):
    tmp = []
    for a in ans_li:
        last = int(a[-1])+1
        for i in range(last+1):
            tmp.append(a+str(i))
    ans_li = tmp
for bb in ans_li:
    ans = ''
    for b in bb:
        ans += alp[int(b)]
    print(ans)
num = int(input())
base = ["a","b","c","d","e","f","g","h","j","k"]

if num == 1:
  print("a")
elif num == 2:
  print("aa")
  print("ab")
elif num == 3:
  print("aaa")
  print("aab")
  print("aba")
  print("abb")
  print("abc")
def p(S):
    str = ""
    for s in S:
        str += chr(ord("a")+int(s))
    print(str)

N = int(input())
S = [0]*N
T = [2]*N

def up(i):
    if i == 0:
        return True
    S[i] += 1
    if S[i] == T[i]:
        S[i] = 0
        T[i] += 1
        return up(i-1)
    return False

while True:
    p(S)
    if up(N-1):
        break
N = int(input())
al = []
alphavets = "abcdefghijklmn"

def solve(N, s):

    if len(s) == N:
        al.append(s)
        return 
    
    for i in range(len(s)+1):
        solve(N, s + alphavets[i])

solve(N, alphavets[0])

al = sorted(al)
for i in al:
    print(i)
n = int(input())

ans = []
def dfs(A):
    if len(A) == n:
        ans.append(''.join(A))
        return
    for i in range(len(A)+1):
        v = chr(i+ord('a'))
        A.append(v)
        dfs(A)
        A.pop()

dfs([])
ans.sort()
for i in range(len(ans)):
    print(ans[i])
start="a"
n=int(input())
ans=[]

def dfs(string,n):
    if len(string)==n:
        print(string)
    else:
        s=string
        for i in range(97,max([ord(j)for j in string])+2):
            dfs(string+chr(i),n)
        

dfs(start,n)
print(len(ans))
for i in ans:
    print(i)
import queue

n = int(input())
alp = "abcdefghijklmn"
q = queue.Queue()
q.put("a")
while not q.empty():
    qi = q.get()
    if len(qi) == n:
        print(qi)
    elif len(qi) < n:
        idx = alp.index(qi[-1])
        for i in range(idx+2):
            q.put(qi+alp[i])
N = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'

cnt = 0
for i in range(N):
    ans = ''
    for j in range(N - 1):
        ans += alpha[0]
    ans += alpha[cnt]
    cnt += 1
    print(ans)
import sys
sys.setrecursionlimit(1000000)

N = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]

def dfs(s, max_i):
  if len(s) == N:
    print(s)
  else:
    for i in range(97,max_i+1):
      dfs(s+chr(i), i+1)

dfs('', 97)
n = int(input())

def dfs(s):
  if len(s) == n:
    print(s)
  else:
    for i in range(ord(s[len(s) - 1]) - ord('a') + 2):
      dfs(s + chr(i + ord('a')))
      
s = 'a'
dfs(s)
a = int(input())
arr = []
s = "abcdefghijklmnopqrstuvwxyz"
if a == 1:
    print("a")
else:
    first = s[0]
    arr.append(first*(a-1))
    for i in range(a-1):
        arr.append(first+s[i+1])
for i in range(len(arr)):
    print(arr[i])
from itertools import product
N=int(input())
s="abcdefghij"
for i in range(N):
  c=s[:i+1]
  for p in product(c,repeat=N-i):
    print(c+"".join(p))
import copy
N=int(input())
alp="abcdefghijklmnopqrstuvwxyz"
l=["a"]
now=[]
flag=0
now=[]

if N==1:
    print(l[0])
    flag=1
else:
    for x in range(N-1):
        for i in range(len(l)):
            now.append(l[i]+"a")
            now.append(l[i]+"b")
        l=copy.deepcopy(now)
        now=[]



if flag!=1:
    l.sort()
    for i in l:
        print(i)
n = int(input())
for i in range(2**(n-1)):
  s = bin(i)[2:]
  pre = '0'*(n-len(s)) + s
  print(''.join(['a' if t=='0' else 'b' for t in pre]))
N = int(input())

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
ans = []
original = []
for i in range(N):
    original.append("a")

usechr = original[:]
for chr in range(N):
    usechr = original[:]
    ans.append("".join(usechr[:-chr-1] + alphabet[:chr+1]))
ans.sort()

for a in ans:
    print(a)
import itertools
n=int(input())
r=[]
for s in itertools.combinations_with_replacement('abcdefghij'[:n],n):
    for _r in r:
        for i in range(n):
            if ord(_r[0])-ord(_r[i]) != ord(s[0])-ord(s[i]):
                break
        else:
            break
    else:
        r.append(s)
for i in range(len(r)):
    print(''.join(r[i]))
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n=int(input())
al=[chr(ord('a') + i) for i in range(15)]
def dfs(c,i):
    if i==n:
        print(c)
        return
    for k in range(ord(c[-1])-ord('a')+2):
        dfs(c+al[k],i+1)
dfs("a",1)
import sys
sys.setrecursionlimit(10 ** 7)

from string import ascii_lowercase
d = dict(zip(ascii_lowercase, range(26)))
N = int(input())

def nexts(s, n):
    if n == N:
        print(s)
        return
    prenum = d[s[-1]] + 1
    for i in range(prenum+1):
        nexts(s + ascii_lowercase[i], n+1)

nexts('a', 1)
n = int(input())

arr= ['a','b','c','d','e','f','g','h','i','j']

def f(x, s):
  if x == n:
    print(s)
    return
  for i in range(n):
    f(x+1, s+arr[i])
    if s+arr[i] == "".join(arr[:i+1]):
      break
f(0, "")
# input1 = list(map(int, (input().split())))

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

N = int(input())

# for i in range(N):
print("aaa")
print("aab")
print("aba")
print("abb")
print("abc")
n=int(input())

def go(s):
   global n
   if len(s)==n:
       print(s)
       return
   last=s[-1]
   for i in range(ord('a'),ord(last)+1):
       go(s+chr(i))
   if last < 'z':
       go(s + chr(ord(last) + 1))

go("a")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

def res(n, cur, ln, k):
    if ln == n:
        print(cur)
        return
    res(n, cur + chr(ord("a") + k), ln+1, k)
    res(n, cur + chr(ord("a") + k+1), ln + 1, k+1)


def main():
    n = getN()
    res(n, "a", 1, 0)
if __name__ == "__main__":
    main()
import sys
from string import ascii_lowercase

alphs = list(ascii_lowercase)

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

def main():
    cur = ['a']
    for _ in range(n-1):
        nex = []
        for c in cur:
            i = ord(c[-1]) - 97
            for al in alphs[:i+2]:
                nex.append(c + al)
        cur = nex
    return sorted(cur)

if __name__ == "__main__":
    ans = main()
    print(*ans, sep='\n')
n = int(input())
if n == 1:
  print('a')
elif n == 2:
  print('aa\nab')
elif n == 3:
  print('aaa\naab\naba\nabb\nabc')
elif n == 4:
  print('aaaa\naaab\naaba\naabb\naabc\nabaa\nabab\nabac\nabba\nabbb\nabbc\nabca\nabcb\nabcc\nabcd')
n=int(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])
print(len(ans))
for i in range(len(ans)):
  print(ans[i][0])
from operator import itemgetter
a = ("a", "b", "c", "d", "e")
N = int(input())
L = [0]*N

alpha=list('abcdefghij')
print('a'*N)
for i in range(N,0,-1):
    for j in range(i,N,1):
        L[j]+=1
        print(''.join([alpha[i] for i in L]))
N = int(input())

def dfs(x):
    if len(x) == N:
        s = "".join(chr(v + ord("a")) for v in x)
        print(s)
        return
    
    val = x[-1] if x else 0
    for i in range(val + 2):
        x.append(i)
        dfs(x)
        x.pop()

dfs([0])
N = int(input())
ans = ["a"]
for i in range(N-1):
    new = []
    for j in range(len(ans)):
        l = ord(ans[j][-1])-95
        add = [chr(ord("a") + idx) for idx in range(l)]
        for k in add :
            new.append(ans[j] + k)
    ans = new

for p in ans:
    print(p)