peterverebics/CodeNet_Python_118 huggingface dataset:
#!python3

import sys
sys.setrecursionlimit(200000)


# input
N = int(input())
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]


def solve(s, m):
    if len(s) == N:
        print(s)
    else:
        for i in range(m + 1):
            solve(s + l[i], max(i + 1, m))


def main():
    solve("a", 1)


if __name__ == "__main__":
    main()
def DFS(word,n):
  if len(word)==N:
    return print(word)
  else:
    for i in range(n+1):
      if i==0 :
        DFS(word+chr(97+i),n+1)
      elif chr(97+i-1) in word:
        DFS(word+chr(97+i),n+1)

N=int(input())
DFS('',0)
# カンニングしました。。。。。。。。

def dfs(s: str, m: int):
    global n
    if len(s) == n:
        print(s)
    else:
        for c in range(ord('a'), m + 1):
            dfs(s + chr(c), m + 1 if c == m else m)


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

alphabets = 'abcdefghijklmnopqrstuvwxyz'

def dfs(s, max_idx):
  if len(s) == N:
    print(s)
    return
  else:
    for i in range(0, max_idx+2, 1):
      t = s
      t = t + alphabets[i]
      dfs(t, max(i, max_idx))
    
dfs("", -1)
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    ans = []
    while stack:
        s = stack.pop()
        if len(s) == N:
            ans.append(s)
            continue
        for suffix in reversed(alphabet[:len(set(s)) + 1]):
            stack.append("".join((s, suffix)))
    return ans


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

    ans = dfs(N)
    print("\n".join(ans))


if __name__ == "__main__":
    main()
import sys
sys.setrecursionlimit(10 ** 8)
n = int(input())
alp = "abcdefghijklmnopqrstuvwxyz"
permutations = []

def dfs(a, size):
    if len(a) == size:
        global permutations
        permutations.append(a)
        return
    for i in range(1, max(a) + 2):
        dfs(a + [i], size)

dfs([1], n)
for i in permutations:
    print(''.join([alp[j-1] for j in i]))
A=[]
B=["a"]
N=int(input())
if N>1:
 for i in range(N-1):
  A=B
  B=[]
  C=len(A)
  for j in range(C):
   F=len(A[j])
   D=0
   for f in range(F):
    D=max(ord(A[j][f])-95,D)
   for k in range(D):
    E=A[j]+chr(97+k)
    B.append(E)
for i in range(len(B)):
 print(B[i])
import sys
sys.setrecursionlimit(10**6)
N = int(input())
def f(n,s):
    if n == 0:
        print(s)
        return
    for i in [chr(ord("a") + i) for i in range(N-n+1)]:
        mx = 0
        for j in s:
            mx = max(mx,ord(j))
        if s != "" and ord(i) - mx > 1:
            return 
        f(n-1,s+i)
f(N,"")
import itertools

n = int(input())
alpha = "abcdefghij"
ans_s = {}
if n == 1:
    print("a")
    exit()

def ans_string(max_num, num, ans):
    if num == 0:
        ans_s[ans] = 1
    else:
        for i in range(max_num + 2):
            ans_string(max(i, max_num), num - 1, ans + alpha[i])
        
ans_string(0, n - 1, "a")
for key, value in ans_s.items():
    print(key)
n = int(input())
ans = ['' for _ in range(n)]

def dfs(i, mx):
    if i == n:
        print(''.join(ans))
        return
    for j in range(mx+1):
        ans[i] = chr(ord('a') + j)
        dfs(i+1, max(j+1, mx))

dfs(0, 0)
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def dfs(s, mx, n):
    l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
    if len(s) == n:
        print(s)
        return
    for i in range(mx+2):
        t = s
        t += l[i]
        dfs(t, max(mx, i), n)


def main():
    n = int(input())
    dfs('', -1, n)


main()
n = int(input())
alp = [chr(i) for i in range(97, 97+26)]
 
def update(a, m):
    a_new = []
    m_new = []
    for val_a, val_m in zip(a,m):
        for i in range(val_m + 2):
            a_new += [val_a + alp[i]]
            m_new += [max(val_m, i)]
    return a_new, m_new
 
a = ['a']
m = [0]
 
for i in range(n-1):
  a, m = update(a,m)
 
for v in a:
  print(v)
import sys
import re
input = sys.stdin.readline

N = int(input())

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
ans = []
for i in range(N):
    if not i:
        ans.append(['a'])
    else:
        l = []
        p = []
        for x in ans[-1]:
            m = max([alpha.index(a) for a in x])
            l.extend([x + a for a in alpha[:m + 2]])

        ans.append(l)

for x in ans[N - 1]:
    print(x)
def dfs(s, mx, N):
    if len(s) == N:
        print s
    else:
        for ch in range(ord('a'), ord(mx) + 1):
            if chr(ch) == mx:
                dfs(s + chr(ch), chr(ord(mx) + 1), N)
            else:
                dfs(s + chr(ch), mx, N)

def solve2():
    N = int(raw_input())
    dfs('', 'a', N)

if __name__ == '__main__':
    solve2()
from itertools import groupby

n = int(input())
r = 'a',
for _ in range(n - 1):
  r = [s + c for s in r for c, _ in groupby(sorted(s) + [chr(ord(max(s)) + 1)])]
print(*r, sep='\n')
N = int(input())

dp = [[] for _ in range(N)]
dp[0].append('a')

for i in range(1, N):
    for strings in dp[i-1]:
        j = 97
        while j <= ord(max(strings))+1:
            nextstr = strings
            nextstr += chr(j)
            dp[i].append(nextstr)
            j += 1

dp[N-1].sort()

for strings in dp[N-1]:
    print(strings)
n = int(input())
def dfs(s, i):
    if i == n:
        print(s)
    else:
        for j in range(ord("a"), max(map(ord, list(s))) + 2):
            dfs(s + chr(j), i + 1)
dfs("a", 1)
n=int(input())
a=['a','b','c','d','e','f','g','h','i','j']

def dfs(s, count):
    if len(s) == n:
        print(s)
        return
 
    for z in range(count + 1):
        dfs(s + a[z], count + 1 if z == count else count)

dfs("",0)
# パナソニック2020D
import sys
def write(x):
    sys.stdout.write(x)
    sys.stdout.write("\n")
    
from queue import deque
n = int(input())
q = deque([("a", "a")])
while True:
    s, m = q.pop()
    if len(s)==n:
        write(s)
    elif len(s)>=n+1:
        break
    for o in range(ord("a"), ord(m)+2):
        if ord(m)<o:
            m = chr(o)
        q.appendleft((s + chr(o), m))
N = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'

def src(s):
  i = 0
  while s != alpha[i]:
    i += 1
  return i
def super_troop(n):
  if n == 1:
    return ['a']
  else:
    L = super_troop(n-1)
    LL = []
    for i in L:
      S = [j for j in i]
      S.sort(reverse=True)
      for k in range(src(S[0])+2):
        LL.append(i + alpha[k])
    return LL
X = super_troop(N)
X.sort()
for i in range(len(X)):
  print(X[i])
def rec(S,depth):
    if depth == 0:
        print(S)
        return
    else:
        list_mozi=list(dict.fromkeys(list(S)))
        list_mozi.sort()
        for j in range(len(list_mozi)):
            rec(S+list_mozi[j],depth-1)
        rec(S+chr(ord(list_mozi[len(list_mozi)-1])+1),depth-1)

N=int(input())
rec("a",N-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)
for line in init_line:
	print(line)
n=int(input())

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

dfs("",ord('a')-1)
alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字

n = int(input())
ans = []
def solve(now,i):
    if len(now) == n:
        ans.append(now)
        return
    for j in range(i+1):
        solve(now+alpha_small_[j],max(i,j+1))

solve("a",1)


for x in sorted(ans):
    print(x)
from string import ascii_lowercase as al


def dfs(p, i):
    if len(p) == N:
        print("".join(p))
        return
    for j in range(i+1):
        if j == i:
            dfs(p + list(al[j]), i+1)
        else:
            dfs(p + list(al[j]), i)


N = int(input())
dfs([], 0)
N = int(input())
S = "abcdefghijklmn"
Q = [(1,1,"a")]
A = []
while Q:
    q = Q.pop(-1)
    if q[0]==N:
        A.append(q[2])
        continue
    for i in range(q[1]+1):
        Q.append((q[0]+1,max(q[1],i+1),q[2]+S[i]))
for a in sorted(A):print(a)
import sys
sys.setrecursionlimit(10**6)
a = int(input())
S = 'abcdefghij'

def dfs(s,c):
    if c == a:
        ans.append(s)
        return 
    for i in S[:c+1]:
        if i in s:dfs(s+i,c+1)
        else:
            dfs(s+i,c+1)
            return 
ans = []

dfs("",0)

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

ans = []
def dp(arg, level):
    global N
    if len(arg) == N:
        ans.append(arg)
        return
    #
    orda = ord('a')
    for i in range(level):
        dp(arg + chr(orda + i), level)
    dp(arg + chr(orda + level), level + 1)
    return

dp('', 0)
for ansi in ans:
    print(ansi)
n = int(input())

abc = list('abcdefghij')


def solve(ans):
    if len(ans) == n:
        print(*ans, sep='')
    else:
        idx = max([abc.index(ans[i]) for i in range(len(ans))])
        for i in range(idx+2):
            nans = ans + [abc[i]]
            solve(nans)


solve(['a'])
n = int(input())
import string
A = [chr(i) for i in range(ord("a"),ord("a")+10)]
B = {}
for i in range(10):
    B[A[i]] = i

def d(s,t,ANS):
    if len(s) == n:
        ANS.append(s)
    else:
        for i in range(t+2):
            d(s + A[i],max(i,t),ANS)
ANS = []

d("",-1,ANS)

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

ans = [0] * n

def prc(L):
    res = []
    for x in L:
        res.append(chr(ord('a') + x))
    print(''.join(res))

while 1:
    prc(ans)
    for i in range(n-1, 0, -1):
        temp = max(ans[:i])
        if ans[i] <= temp:
            ans[i] += 1
            for j in range(i+1, n):
                ans[j] = 0
            break
    else:
        break
n = int(input())
A = 'a'
S ='abcdefghij'
for _ in range(n-1):
    A = [a + s for a in A for s in S[:len(set(a))+1]]
print(*A, sep='\n')
N = int(input())
char = ["a","b","c","d","e","f","g","h","i","j"]
pre = [("",0)]
for i in range(N):
    nx = []
    for s,cnt in pre:
        for c in char[:cnt]:
            nx.append((s+c,cnt))
        c = char[cnt]
        nx.append((s+c,cnt+1))
    pre = nx

for s,_ in pre:
    print(s)
k = "a",
for _ in range(int(input()) - 1):
  k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n')
import copy

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

n = int(input())

value = ['a']
for i in range(10):
    if len(value[0]) == n:
        break
    tmp_value = copy.copy(value)
    value = []
    for v in tmp_value:
        for j in range(n):
            value.append(v + ab[j])
            if ab[j] not in v:
                break
for v in value:
    print(v)
n=int(input())

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

dfs("a",ord("a"))
N = int(input())

def it(i,n):
    if i == N:
        yield [None]*N
    else:
        for x in range(n):
            for d in it(i+1,n):
                d[i] = x
                yield d
        for d in it(i+1,n+1):
            d[i] = n
            yield d

print(*(''.join(chr(x+ord('a')) for x in d) for d in it(0,0)), sep='\n')
N = int(input())
strlist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


ans = [['a']]
for i in range(1, N):
  ans.append([])
  for s in ans[i-1]:
    n = len(set(s))
    for j in range(n+1):
      ans[i].append(s+strlist[j])

ans.sort()
print(*ans[-1], sep='\n')
def dfs(N, s, maxc):
    if len(s) == N:
        print(s)
    else:
        for i in range(ord(maxc)-ord('a') + 2):
            ord_c = ord('a')+i
            dfs(N, s+chr(ord_c), chr(max(ord_c, ord(maxc))))

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

pre = [[0]]
ans = [[0]]
s = 'abcdefghijklmnop'

for i in range(n-1):
    ans = []
    for item in pre:
        for j in range(max(item)+2):
            ans.append(item + [j])
    pre = ans[:]

res = []
for item in ans:
    print("".join([s[c] for c in item]))
n = int(input())

def calc(x_list):
    tmp  = []
    for x in x_list:
        m = max(x)
        for alpha in range(ord('a'), ord(m) + 2):
            tmp.append(x + chr(alpha))
    if len(tmp[-1]) < n:
        tmp = calc(tmp)
    return tmp

ans = calc(['a'])
ans.sort()
if n >= 2:
    print(*ans, sep="\n")
else:
    print('a')
N = int(input())
ans_list = ["a"]
alphabet = [chr(ord("a") + i) for i in range(N)]

for i in range(N - 1):
    ans_list = [ ans + x for ans in ans_list for x in alphabet[:len(set(ans)) + 1]]

for ans in ans_list:
    print(ans)
def num_to_str(n):
    return chr(97 + n)

def str_to_num(s):
    return ord(s) - 97

def dfs(s,m,n,N,ans):
    if n == N:
        ans.append(s)
        return
    for i in range(m+2):
        dfs(s+num_to_str(i),max(m,i),n+1,N,ans)

def main():
    N = int(input())
    ans = []
    dfs('a',0,1,N,ans)
    ans.sort()
    for a in ans:
        print(a)


if __name__ == "__main__":
    main()
N = int(input())
w = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


def dfs(s, i):
    # s:文字列 i:最大のアルファベットのindex
    if len(s) == N:
        print(s)
    else:
        for k in range(i+2):
            if k == i+1:
                dfs(s+w[k], i+1)
            else:
                dfs(s+w[k], i)


x = dfs('a', 0)
import string
N = int(input())
alph = string.ascii_lowercase

ans = []
A = [0]
def search():
    if len(A) == N:
        ans.append(tuple(A))
        return

    mx = max(A)
    for i in range(mx + 2):
        A.append(i)
        search()
        A.pop()
    return

search()

for a in ans:
    print(''.join(alph[i] for i in a))
N = int(input())
def dfs(ch, Ma):
    if len(ch) == N:
        print(ch)
        return
    for i in range(97, Ma+2):
        dfs(ch+chr(i), max(Ma, i))
dfs('a', 97)
n = int(input())
a1 = list("abcdefghij")

b1 = [[0]]
c1 = 1
ans = []
while c1 < n:
    c1 += 1
    b2 = b1 + []
    b1 = []
    for i in b2:
        imax = max(i)
        for j in range(imax+2):
            b1.append(i+[j])

for i in b1:
    ans = [a1[j] for j in i]
    print("".join(ans))
def main():
    number = int(input())
    queue = ["a"]
    for i in range(number - 1):
        now_queue = []
        for now in queue:
            limit = ord(max(now)) + 2
            for j in range(ord("a"), limit):
                now_queue.append(now + chr(j))
        queue = now_queue
    for q in queue:
        print(q)


if __name__ == '__main__':
    main()
string=['a','b','c','d','e','f','g','h','i','j']
N=int(input())
res=[]
def dfs(ss):
  if len(ss)==N:
    ss=''.join(ss)
    res.append(ss)
  else:
    for i in range(string.index(max(ss))+2):
      a=ss+[string[i]]
      dfs(a)
  return res
ans=dfs(['a'])
for i in range(len(ans)):
  print(ans[i])
n = int(input())
def dfs(i,s):
    if i == n:
        print(s)
        return
    ma = 0
    for j in s:
        ma = max(ma,ord(j))
    for j in range(ma - 95):
        dfs(i+1,s+chr(97+j))
    return
dfs(1,"a")
from collections import deque

N = int(input())

l = deque(['a'])

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

for i in range(1, N):
    #print(i)
    len_l = len(l)
    for k in range(len_l):
        x = l.popleft()
        for j in range(len(set(x))+1):
            #print(i, k, j)
            l.append(x+alpha[j])
            #print(l)

#l =sorted(l)

for i in l:
    print(i)
str = 'abcdefghijklmnop'
def bt(n,m,s):
  if n == 0:
    print(s)
    return
  for c in range(m):
    bt(n-1,m,s+str[c])
  #introduce another character
  bt(n-1,m+1,s+str[m])
n = int(input())
bt(n,0,'')
# -*- coding: utf-8 -*-

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

def get_str(seq_list):
    result = []
    for seq in seq_list:
        used_char_num = len(set(seq))
        for i in range(used_char_num + 1):
            result.append(seq + chars[i])
    return result

N = int(input())

seq_list = ["a"]
for i in range(N - 1):
    tmp = seq_list[:]
    seq_list = get_str(tmp)

for s in seq_list:
    print(s)
n=int(input())
def dfs(s):
    if len(s)==n:print(s)
    else:
        for i in range(97,ord(max(s))+1+1):
            dfs(s+chr(i))
dfs("a")
from string import ascii_lowercase as alph

def gen_pattern(N, pre="", m=0):
  if len(pre)+1 == N:
    for c in alph[:m+1]:
      yield pre+c
  else:
    for c in alph[:m]:
      yield from gen_pattern(N, pre+c, m)
    yield from gen_pattern(N, pre+alph[m], m+1)

for pattern in gen_pattern(int(input())):
  print(pattern)
def dfs(a='', b=chr(ord('a'))):
	if len(a) == N:
		print(a)
	else:
		i = chr(ord('a'))
		while i < b:
			dfs(a + i, b)
			i = chr(ord(i) + 1)
		dfs(a + b, chr(ord(b) + 1))

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


def f(s, max_i):
    if len(s) >= n:
        print(s)
    else:
        for i in range(max_i+2):
            f(s + chr(ord('a') + i), max(max_i, i))


f('a', 0)
N=int(input())
l=["a","b","c","d","e","f","g","h","i","j"]
def hu(t,c,n):
    if n<N:
        for i in range(0,c):
            hu(t+[i],c,n+1)
        hu(t+[c],c+1,n+1)
    else:
        pr(t)
def pr(t):
    for i in t:
        print(l[i],end="")
    print()
hu([0],1,1)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

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

ans = []
def dfs(idx, cnt, lis):
    if idx==N:
        ans.append(''.join(lis))
        return
    for i in range(cnt):
        dfs(idx+1, cnt, lis+[alpha[i]])
    dfs(idx+1, cnt+1, lis+[alpha[cnt]])
    return

dfs(0, 0, [])
ans.sort()
for a in ans:
    print(a)
def getStr(vars):
    if len(vars)==N:
        print(getPrintStr(vars))
        return
    
    vars.append(0)
    for i in range(0,max(vars)+2):
        vars[-1] = i
        #print(":", i, vars)
        getStr(vars)
    del vars[-1]
    return

def getPrintStr(vars):
    ret = ""
    for i in range(len(vars)):
        ret += "abcdefghijkl"[vars[i]]
    return ret

N = int(input())
 
getStr([0])
n = int(input())
strings = [[] for _ in range(n)]
for i in range(n):
    if not i:
        strings[i].append("a")
        continue
    for s in strings[i-1]:
        for j in range(ord("a"),ord(max(s))+2):
            c = chr(j)
            strings[i].append(s+c)
print(*strings[-1])
from string import ascii_lowercase

n = int(input())

def f(l):
    if len(l)==n:
        print("".join([ascii_lowercase[i] for i in l]))
        return
    
    for i in range(max(l)+2):
        f(l+[i])

f([0])
N=int(input())

l=["a"]

a=ord("a")

for i in range(N-1):
    la=[]
    for j in l:
        b=ord(max(j))
        for k in range(a,b+2):
            la.append(j+chr(k))
    l=la

for i in l:
    print(i)
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    ABC = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")

    def dfs(s, n, i):
        if n == N:
            print(s)
            return
        for j in range(i+1):
            dfs(s + ABC[j], n+1, i + 1 if i == j else i)
    dfs("a", 1, 1)

if __name__ == '__main__':
    main()
ans = []
type = [[1]]
que = []
N = int(input())
for i in range(N-1):
    que = type
    type = []
    while len(que) != 0:
        t = que.pop()
        ma = max(t)
        for j in range(1,ma+2):
            type.append(t + [j])
type.sort()
char = " abcdefghijklmnopqrstuvwxyz"
for a in type:
    print("".join(map(lambda x: char[x], 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",0]]


	for i in range(1,10):

		for t,val in li[i-1]:
			for j in range(val+2):
				li[i].append([t+s[j],max(val,j)])

	for t,_ in li[n-1]:
		print(t)


if __name__ == "__main__":
	main()
#解説AC

n = int(input())

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

            dfs(s + chr(i), chr(ord(mx) + 1) if i == ord(mx) else mx)
dfs('', 'a')
N = int(input())

tmp = [[1]]
answer = tmp

for i in range(N - 1):
    tmp = []
    for a in answer:
        max_a = max(a)
        for j in range(1, max_a + 2):
            tmp.append(a + [j])
    answer = tmp

answer.sort()

def alpha(l):
    res = ""
    for ll in l:
        res += chr(ll + ord("a") - 1)
    return res

for a in answer:
    print(alpha(a))
n=int(input())
l=[["a"]]+[[] for i in range(9)]
for i in range(9):
  for j in l[i]:
    k=len(set(list(j)))
    for h in range(k+1):
      l[i+1].append(j+chr(97+h))
for i in l[n-1]:print(i)
n = int(input())

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

def moji(mes, layer, lim):
    if(layer==n):
        print(mes)
        return
    for i in range(lim+1):
        moji(mes+l[i], layer+1, max(lim,i+1))
    return

moji("", 0, 0)
N = int(input())

arr=[1]*N

s = ['' for i in range(N)]

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

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

def dfs(k,c):
    if(k==N):
        print("".join(s))
        return
    for i in range(c):
        s[k]=num2alpha(i)
        dfs(k+1,c)
    s[k]=num2alpha(c)
    dfs(k+1,c+1)

dfs(0,0)
from collections import deque

N = int(input())
d = {i:[] for i in range(1, N+1)}
q = deque([(1, "a")])

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

for i in d[N]:
    print(i)
n=int(input())
l=[[] for i in range(n)]
l[0]=[[0]]
for i in range(n-1):
  for j in l[i]:
    for k in range(max(j)+2):
      l[i+1].append(j+[k])

for i in range(len(l[n-1])):
  for j in range(n):
    print(chr(l[n-1][i][j]+97), end="")
  print()
N = int(input())

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

dfs('', 0)
numal=lambda c:chr(c+97)
n=int(input())
unchi=[[],[],[],[],[],[],[],[],[],[]]
unchi[0].append("0")
k=1
if n>=2:
	while k<n:
		for i in range(len(unchi[k-1])):
			t=max(map(int, unchi[k-1][i]))
			for u in range(t+2):
				unchi[k].append(unchi[k-1][i]+str(u))
		k+=1
for i in range(len(unchi[n-1])):
	s = []
	for k in range(n):
		s.append(numal(int(unchi[n-1][i][k])))
	print("".join(s))
# D
N = int(input())

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

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

for w in dfs([], 0):
    print(w)
def dfs(n, i, s, maxi):
    global ans
    maxi = max(i, maxi)
    s += chr(i)
    if n == N:
        ans += [s]
        return
    for ii in range(97, maxi+2):
        dfs(n+1, ii, s, maxi)

N = int(input())
i = 97
ans = []
dfs(1, 97, '', 97)
ans = sorted(ans)
for a in ans:
    print(a)
def dfs(now, mx):
    if len(now) == n:
        print(now)
    else:
        for i in range(1, mx + 2):
            mmx = max(mx, i)

            dfs(now + al[i], mmx)


n = int(input())

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

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

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

def dfs(st, n, k):
    if n == N:
        print(st)
    else:
        for i in range(k+1):
            if i < k:
                dfs(st + alph[i], n+1, k)
            else:
                dfs(st + alph[i], n+1, k+1)

dfs("", 0, 0)
s = 'abcdefghij'
sg = s.__getitem__


def dfs(ans):
    if len(ans) == n:
        print(''.join(map(sg, ans)))
        return
    for i in range(max(ans) + 2):
        ans.append(i)
        dfs(ans)
        ans.pop()


n = int(input())
dfs([0])
n = int(input())
dict = {1:"a", 2:"b", 3:"c", 4:"d", 5:"e", 6:"f", 7:"g", 8:"h", 9:"i", 10:"j"}
ans = [["a", 1]]
for i in range(n-1):
    newans = []
    for lis in ans:
        now = lis[0]
        count = lis[1]
        for j in range(1, count + 2):
            newans.append([now + dict[j], max(j, count)])
    ans = newans
for lis in ans:
    print(lis[0])