peterverebics/CodeNet_Python_118 huggingface dataset:
# -*- coding: utf-8 -*-

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

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())
s = ['a'] * n
ans = []
ans.append(''.join(s))
for i in range(1,n):
    for j in range(i,n):
        s = ['a'] * n
        s[j] = 'b'
        ans.append(''.join(s))
ans.sort()
for i in ans:
    print(i)
N = int(input())
ans = []
def dfs(s):
    if(len(s) == N):
        ans.append(s)
        return
    else:
        next_str = ord(s[-1]) + 1
        for i in range(ord("a"), next_str + 1):
            dfs(s + chr(i))

dfs("a")

ans = sorted(ans)
for a in ans:
    print(a)
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"]
n = int(input())
ans = [[] for i in range(n)]
ans[0].append("a")

for i in range(1,n):
    for j in ans[i-1]:
        for k in range(ord(j[-1])-ord("a")+2):
            an = j + l[k]
            ans[i].append(an)
count = ans[-1]
for i in count:
    print(i)
N=input()
A="abcdefghij"

S=["a"]
for n in range(2,N+1):
    temp=[]
    for s in S:
        for i in range(n):
            temp.append(s+A[i])
    S=temp

S.sort()
for x in S:
    print x
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter

import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())

strlist = "abcdefghij"

def dfs(s,num):
    if len(s) == n:
        print(s)
    elif num ==0:
        dfs("a",1)
    else:
        for i in range(num+1):
            dfs(s+strlist[i],num+1)

dfs("",0)
N=int(input())
ans="a"*N
L=["b","c","d","e","f","g","h","i","j","k"]
for i in range(N-1):
    ans+="\n"+"a"*(N-1)+L[i]
print(ans)
N = int(input())
alphabets = list('Zabcdefghijklmn')
s = ['a']
for i in range(2, N + 1):
    subset = alphabets[1:i + 1]
    # s = [s[j] + k for k in subset for j in range(len(s))]
    s = [s[j] + k for j in range(len(s)) for k in subset]
print(*s, sep='\n')
N = int(input())

a_num = 97

def dfs(s, n, cnt): #s: 現在の文字列, n: 残りの文字数, cnt: 現在の文字列の最大の値
    if n == 0:
        print(s)
        return
    for i in range(cnt+2):
        if i == cnt+1:
            dfs(s+chr(a_num+i), n-1, cnt+i)
        else:
            dfs(s+chr(a_num+i), n-1, cnt)

dfs("a", N-1, 0)
n = int(input())
ans = []
for i in range(2 ** n):
    s = ['a'] * n
    for j in range(n):
        if ((i >> j) & 1):
            s[n - 1 - j] = 'b'
    ans.append(''.join(s))
ans.sort()
for i in ans:
    if i[0] != 'b':
        print(i)
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    n -= 1
    now = ['a']
    for _ in range(n):
        next = []
        for S in now:
            d = ord(min(S)) - ord('a')
            for i in range(d+2):
                next.append(S + chr(i + ord('a')))
        now = next

    now.sort()
    for S in now:
        print(S)
resolve()
n = int(input())
def print_from_l(l):
    print(''.join(map(lambda s:chr(97+s), l)))
def g(l):
    if len(l) == n:
        print_from_l(l)
    else:
        for i in range(l[-1]+2):
            g(l + [i])
g([0])
# input1 = list(map(int, (input().split())))


def func(n, sss, d):
    for i in range(n):
        if d == N:
            print(sss + s[i])
        else:
            func(i + 2, sss + s[i], d+1)


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

N = int(input())

func(1, "", 1)
import sys
sys.setrecursionlimit(10**7)
n = int(input())
ans = []

def rec(s, k, len):
    if len >= n:
        ans.append("".join([chr(ord("a") + x) for x in s]))
        return
    for x in range(max(s[-1]+2, k+1)):
        rec(s + [x], max(k, x), len+1)

rec([0], 1, 1)
ans.sort()
print(*ans, sep="\n")
N = int(input())

def standard(n, cur):
  if n == 0:
    print(''.join(cur))
  else:
    c = ord(cur[-1]) - ord('a') + 1
    for i in range(c + 1):
      standard(n - 1, cur + [chr(ord('a') + i)])

standard(N - 1, ['a'])
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]:
            if ord(aa[-1])+1 < ord(c): break

            a[i].append(aa+c)

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

tank = []
res = ["a"]

for le in range(1,n):
    tank = res
    res = []
    for i in range(len(tank)):
        tmp = "a"
        for j in range(le):
            res.append(tank[i] + tank[i][j])
            if tank[i][j] > tmp:
                tmp = tank[i][j]
        res.append(tank[i] + chr(ord(tmp)+1))
    res = list(set(res))

print(*res)
N = int(input())

lst = []
m = 0
temp = [[0]]

while temp:
    p = temp.pop()
    if len(p)==N:
        lst.append(p)
    else:
        for i in range(p[-1]+2):
            s = p[:]
            s.append(i)
            temp.append(s)

lst.sort()
abc = 'abcdefghij'
for l in lst:
    print(*[abc[i] for i in l], sep='')
N = int(input())

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


def dfs(ans, keep_num, n):
    if n == N - 1:
        for i in range(keep_num + 2):
            print(ans + lis[i])
    else:
        for i in range(n + 1):
            dfs(ans + lis[i], max(i, keep_num), n + 1)


dfs('', -1, 0)
import sys
input = sys.stdin.readline

def main():

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

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

    add_str(S)

if __name__ == '__main__':
    main()
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    ans = ["a"]
    alt = [chr(ord("a") + i) for i in range(n)]
    for i in range(n-1):
        ans = [s+x for s in ans for x in alt [0:len(set(ans))+1]]
    for i in ans:
        print(i)
    return 0

if __name__ == "__main__":
    solve()
N = [int(i) for i in input().split()][0]
ordA = ord("a")

def recursion(x, k, c, words):
  if k == 0:
    words.append(x)
    return
  for i in range(c+2):
    recursion(x+chr(ordA+i), k-1, i, words) 
  
words = []
recursion("a", N - 1, 0, words)
for word in words:
  print(word)
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],j+1)

solve("a",1)
for x in ans:
    print(x)
n=int(input())
ans=[]
def b(s):
  if len(s)==n:
    ans.append(s)
    return
  for i in "abcdefghijklmnopqrstuvwxyz":
    b(s+i)
    if s[-1]==chr(ord(i)-1):return
b("a")
ans.sort()
for i in ans:print(i)
N = int(input())
chrA = ["aaaaaaaaaa", "aaaaaaaaab", "aaaaaaaaba", "aaaaaaaabb", "aaaaaaabaa", "aaaaaaabab", "aaaaaaabba","aaaaaaabbb","aaaaaabaaa","aaaaaabaab"]

for i, chra in enumerate(chrA):
    print(chra[-N:])
    if i + 1 == N:
        exit()
N = int(input())

def bfs(s, cnt):
	if cnt == N:
		print(s)
		return 0

	for i in range(97,ord(s[-1])+2):
		bfs(s+chr(i), cnt+1)

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

def dfs(ans,count):
    if len(ans)==n:
        print(ans)
    else:
        for i in range(n):
            dfs(ans+chr(97+i),count+1)

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

my_list = []
for i in range(N):
    if i == 0:
        my_list.append("a")
        continue
    new_list = []
    while my_list:
        s = my_list.pop(0)
        for j in range(ord("a"), ord(s[-1]) + 2):
            new_list.append(s + chr(j))
    my_list += new_list
my_list.sort()

[print(s) for s in my_list]
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(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)
import itertools
import sys
s = ["a","b","c","d","e","f","g","h","i"]
n=int(input())
l = ["a"]

x = 1
while(x <= n):
    ll = l
    l = []
    for i in ll:
        for j in s[:x-1]:
            l.append(i + j)
    l.append("".join(s[:x]))
    x = x + 1
print(l)
def solve():
    N = int(raw_input())
    ret = ['a']
    for i in range (2, N+1):
        tmp = []
        for stri in ret:
            for j in range(ord('a'), ord(stri[-1]) + 2):
                tmp.append(stri + chr(j))
        ret = tmp
    for stri in ret:
        print stri

if __name__ == '__main__':
    solve()
import copy
n = int(input())
w_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
ans_list = []
for i in range(n):
    temp_word = []
    word = []
    for j in range(n):
        if temp_word == []:
            w = copy.deepcopy(w_list[0:i+1])
            temp_word.extend(w)
        aaa = temp_word.pop(0)
        word.append(aaa)
    ans_list.append(''.join(word))
for s in ans_list:
    print(s)
import string
#n = int(input())
n = 5
cs = string.ascii_lowercase
cm = {cs[i]:i for i in range(len(cs))}

def rec(st, m):
    if (len(st) >= n):
        print(st)
        return 0
    for c in cs[:m+1]:
        rec(st + c,max(cm[c]+1,m))

rec('a',1)
#N=4まで
N=int(input())
P="abcdefghij"

print(P[0]*N)
if N>1:
  print(P[0]*(N-1)+P[1])
  if N>2:
    for l in range(2):
      print(P[0]*(N-2)+P[1]+P[l])
    print(P[0]*(N-2)+P[1]+P[2])
    if N>3:
      for m in range(3):
        for n in range(3):
          print(P[0]*(N-3)+P[1]+P[m]+P[n])
      print(P[0]*(N-3)+P[1]+P[2]+P[3])
def main():
    n = int(input())

    ans = []

    def fanc(i, l, s):
        if l == n:
            ans.append(s)
        else:
            for x in range(i+1):
                fanc(max([x, i]) + 1, l + 1, s + chr(97 + x))
                # fanc(x + 1, l + 1, s + chr(97 + x))

    fanc(0, 0, "")

    for i in ans:
        print(i)

main()
n = int(input())

s = [chr(ord('a') + i ) for i in range(n)]
ans = set()
def dfs(i,now):
  if len(now) == n:
    ans.add(now)
    return
  for j in range(min(0,i-1),n):
    dfs(j+1,now + s[j])

dfs(0,s[0])

ans = sorted(list(ans))
for v in ans:
  print(v)
import sys 
sys.setrecursionlimit(4100000)

N = int(input())

def dfs(i,s):
    if len(s) == N:
        
        return print(s)
    
    for x in range(97,i + 1):
        t = s + chr(x)
        
        dfs(x + 1,t)
    
    
dfs(ord("a"),"")
n = int(input())
import copy
for i in range(2**(n-1)):
    p = []
    s = copy.deepcopy(i)
    for j in range(n):
        if s&1 == 0:
            p.append('a')
        else:
            p.append('b')
        s >>= 1
    p.reverse()
    print(''.join(p))
N = 3
alpha = ["a","b","c","d","e","f","g","h","i","j"]
s = "".join(alpha[:N])
print("a"*N)
print(s)
N = int(input())

lst = []

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


def dfs(s, n):
    lst.append(s)
    if n == N:
        return
    else:
        for i in range(n + 1):
            dfs(s + d[i], n + 1)


dfs('a', 1)
for i in range(len(lst)):
    if len(lst[i]) == N:
        print(lst[i])
def dfs(i,sent):
    if len(sent)==N:
        print(sent)
        return
    if i>N:
        return
    for j in range(i+1):
        dfs(max(i,j),sent+chara[j])
    return

N=int(input())
chara=["a","b","c","d","e","f","g","h","i","j"]
chara=chara[:N]
dfs(1,"a")
N = int(input())
chrA = ["aaaaaaaaaa", "aaaaaaaaab", "aaaaaaaaba", "aaaaaaaabb", "aaaaaaaabc", "aaaaaaabaa", "aaaaaaabab","aaaaaaabac","aaaaaaabba","aaaaaaabbb"]

for i, chra in enumerate(chrA):
    print(chra[-N:])
    if i + 1 == N:
        exit()
c = 'abcdefghij'

def join(s, k, n):
    if len(s) == n:
        return [s]
    ans = []
    for i in range(n - len(s), 0, -1):
        ans += join(s + c[k] * i, k + 1, n)
    return ans

n = int(input())
ans = join('', 0, n)
for x in ans:
    print(x)
# D - String Equivalence
from string import ascii_lowercase


def dfs(n: int) -> list:
    if n == 1:
        return ["a"]
    cur = dfs(n - 1)
    result = []
    for s in cur:
        for c in ascii_lowercase[: len(s) + 1]:
            result.append(s + c)
    return result


def main():
    N = int(input())
    result = dfs(N)
    result.sort()
    print("\n".join(result))


if __name__ == "__main__":
    main()
import itertools

n=int(input())

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

count = 0

for i in itertools.product(A, repeat=n):
    print(''.join(map(str,i)))
    count += 1
    if count == n:
        break
n=int(input())
from collections import deque
d=deque(['a'])
x=[-1,0,1]
c=[chr(i) for i in range(97, 97+n)]
ans=set([])
while d:
  y=d.pop()
  if len(y)==n:
    ans.add(y)
  now=c.index(y[-1])
  for z in x:
    if now+z>-1 and len(y)<n:
      d.append(y+c[now+z])
for z in sorted(list(ans)):
  print(z)
n = int(input())
n2 = (n**2) - 1
for i in range((2)**(n-1)):
    # print(i)
    ans = []
    s = list(str(format(i, '010b')))
    for i in s:
        if i == "0":
            ans.append("a")
        else:
            ans.append("b")
    
    s = ''.join([str(n) for n in ans[10-n:]])
    print(s)
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
        if T[i] < N:
            T[i] += 1
        return up(i-1)
    return False

while True:
    p(S)
    if up(N-1):
        break
import string

alphabet = string.ascii_lowercase

n = int(input())

def DFS(before,keta,num):
    if keta == n:
        print(before)
        return
    for i in before:
        num = max(num,alphabet.index(i))
    for j in range(num+1):
        DFS(before+alphabet[j],keta+1,num+1)
DFS("",0,0)
import sys
n = int(sys.stdin.readline())

ans = [['a']]
plus = ('a', 'b')

for _ in range(n-1):
    l = []
    for s in ans[-1]:
        for x in plus:
            l.append(s+x)
    ans.append(l)

ans[-1].sort()
print('\n'.join(ans[-1]))
n = int(input())
alpha_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
  alpha_dict[i] = str(chr(c)).lower()


ans = []
def dfs(s, mx, ans):
  if len(s) == n:
    ans += [s]
    return 
  else:
    for i in range(mx+1):
      dfs(s+alpha_dict[i], max(i, mx+1), ans)

dfs("", 0, ans)
ans = sorted(ans)
for a in ans:
  print(a)
n = int(input())
alphabets = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]


def dfs(s):
    if len(s) == n:
        print(s)
    else:
        pre = "a"
        idx = 0
        for i, c in enumerate(list(s)):
            if pre < c:
                pre = c
                idx = i
        for i in range(idx + 2):
            dfs(s + alphabets[i])


dfs("a")
#!/usr/bin/env python
# coding: utf-8

# In[56]:


N = int(input())


# In[59]:


num2alpha = lambda c: chr(c%26+97)


# In[61]:


ans = []
for i in range(2**(N-1),2**N):
    mylist = list(format(i,"b"))
    word = ""
    cnt = -1
    for x in mylist:
        if x == "1":
            cnt += 1
        word += num2alpha(cnt)
    ans += [word]
for w in ans:
    print(w)


# In[ ]:
n=int(input())
def b(s):
  if len(s)==n:print(s);return
  for i in "abcdefghijklmnopqrstuvwxyz":
    b(s+i)
    if s[-1]==chr(ord(i)-1):return
b("a")
N = int(input())
if (N == 1):
  print('a')
  exit()
elif (N == 2):
  print('aa')
  print('ab')
  exit()
elif (N == 3):
  print('aaa')
  print('aab')
  print('aba')
  print('abb')
  exit()
elif (N == 4):
  print('aaaa')
  print('aaab')
  print('aaba')
  print('aabb')
  print('abaa')
  print('abab')
  print('abbb')
  exit()
# Panasonic2020 D

n = int(input())

for i in range(n):
    print("a"*(n-1) + chr(65+i).lower())
n = int(input())
s = 'a'

def func(s, count):
    if count == n:
        print(s)
        return
    for i in range(count + 1):
        func(s + chr(ord('a') + i), count + 1)

func(s, 1)
n = int(input())

if n == 3:
    print("aaa", "aab", "aba", "abb", "abc")
import string

def generate(n, cur = None, alphabet = None):
    if cur is None:
        cur = []
    if alphabet is None:
        alphabet = list(string.ascii_lowercase)[::-1]
    if n == 0:
        print(''.join(cur))
        return
    for i in range(len(cur)):
        cur.append(cur[i])
        generate(n - 1, cur, alphabet)
        cur.pop()
    cur.append(alphabet.pop())
    generate(n - 1, cur, alphabet)
    alphabet.append(cur.pop())

generate(int(input()))
n = int(input())
a = ["a","b","c","d","e","f","g","h","j","k"]
def dfs(s, max_x, LEN):
  if LEN == n:
    print(s)
  else:
    for c in a[:a.index(max_x)+2]:
      dfs(s+c, max(max_x,c), LEN+1)
dfs("a", "a", 1)
N = int(input())

ans = ['a']
for i in range(N-1):
    tmp = []
    for s in ans:
        j = ord(s[-1]) - ord('a') + 1
        for k in range(j+1):
            tmp.append(s + chr(ord('a') + k))
    ans = tmp
print(*ans, sep='\n')
N = int(input())

my_list = []
for i in range(N):
    if i == 0:
        my_list.append("a")
        continue
    new_list = []
    while my_list:
        s = my_list.pop(0)
        for j in range(ord("a"), ord(s[-1]) + 2):
            new_list.append(s + chr(j))
    my_list += new_list

[print(s) for s in my_list]
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)

print(len(ans))
d = int(input())
chars = '_abcdefghij'


def solve(L, depth):
    if depth == d:
        print(''.join([chars[i] for i in L]))
        L.pop()
        return
    else:
        for i in range(1, L[depth - 1] + 2):
            L.append(i)
            solve(L, depth + 1)
        L.pop()


solve([1], 1)
n=int(input())
ans=[[] for _ in range(10) ]
for i in range(10):
  ans[i]=["" for _ in range(int(2**i))]
ans[0]=["a"]
ans[1]=["aa","ab"]
abc=["a","b","c","d","e","f","g","h","i","j"]
if n>2:
  for i in range(2,n):
    str=ans[i-1]
    ii=0
    for x in str:
      jj=abc.index(x[-1])
      ans[i][ii]=x+"a"
      ans[i][ii+1]=x+abc[jj+1]
      ii+=2
#print(len(ans[n-1]))

for x in ans[n-1]:
    print(x)
N = input()

N = int(N)
if N == 1:
    print("a")
    exit()
# 97 a
string_list = []


def temp(now, string, count):
    if count == N:
        string_list.append(string)
        return 0
    temp(now, string+chr(now), count+1)
    temp(now+1, string+chr(now+1), count+1)
    if now != 97:
        temp(now-1, string+chr(now-1), count+1)
    return 0


temp(97, "a", 1)
string_list.sort()
print(string_list)
import string

def generate(n, res, cur = None, alphabet = None):
    if cur is None:
        cur = []
    if alphabet is None:
        alphabet = list(string.ascii_lowercase)[::-1]
    if n == 0:
        res.append(''.join(cur))
        return
    for i in range(len(cur)):
        cur.append(cur[i])
        generate(n - 1, res, cur, alphabet)
        cur.pop()
    cur.append(alphabet.pop())
    generate(n - 1, res, cur, alphabet)
    alphabet.append(cur.pop())

res = []
generate(int(input()), res=res)
res = sorted(res)
for row in res:
    print(row)
n=int(input());s=['a']
while len(s)>0:
  t=s.pop(-1)
  if len(t)==n:print(t)
  else:
    for a in range(ord(t[-1])+1,96,-1):s.append(t+chr(a))
import itertools
N = int(input())

A = []
for i in range(N):
  if i == 0:
    A.append(())
  else:
    A += list(itertools.combinations(range(N-1),i))

ans = []
for a in A:
  s = 'a'
  if len(a) == 0:
    ans.append(s*N)
  else:
    tmp = ''
    cnt = 0
    for i in a:
      tmp += s*(i+1-cnt)
      cnt = i+1
      s = chr(ord(s)+1)
    if len(tmp) < N:
      tmp += s*(N-len(tmp))
    ans.append(tmp)
ans.sort()
for a in ans:
  print(a)
from itertools import product
N = int(input())

c = [chr(97 + i) for i in range(N)]

ans = []
for i in range(1, N):
    S = c[:i]
    tmp = [1] * i
    add = N - i
    for p in product(range(N - i + 1), repeat=i):
        if sum(p) == add:
            letter = ""
            for j in range(i):
                letter += S[j] * (tmp[j] + p[j])
            ans.append(letter)
ans.append("".join(c[:N]))

ans.sort()
print(*ans, sep="\n")
alpha_small_ = [chr(i) for i in range(97, 97+26)] #アルファベッドの小文字

n = int(input())
data = [[] for _ in range(n)]
data[0] = [("a",1)]
for i in range(1,n):
    for x,j in data[i-1]:
        for k in range(j+1):
            if k == j:
                data[i].append((x+alpha_small_[k],j+1))
            else:
                data[i].append((x + alpha_small_[k], k+1))

for x in data[-1]:
    print(x[0])
import string
# print(string.ascii_lowercase[:10])
ans = []
N = int(input())

def rec(s):
    if len(s) == N:
        ans.append(s)
        return
    for c in string.ascii_lowercase[:N]:
        rec(s + c)

rec("a")
for x in ans:
    print(x)
n=int(input())
for i in range(2**(n-1)):
  print("a",end="")
  for j in range(n-1):
    print("a" if (i>>(n-j-2))%2==0 else "b", end="")
  print()
import sys

N=int(input())
def num2alpha(num):
    return chr(97+num)
print(''.join(['a']*N))
for i in range(N-1):
  a=['0']*N
  while True:
    a=[i for i in str(int(''.join(a))+1).zfill(N)]
    print(''.join([num2alpha(int(i)) for i in a]))   
    
    if a[N-i-1]>max(a[:N-i-1]):
      break
N=int(input())
ans = []
def same(c):
    if len(c)==N:
        ans.append(c)
        return
    else:
        for i in range(ord('a'),ord(c[-1])+2):
            same(c+chr(i))
same('a')
for i in sorted(ans):
    print(i)
n=int(input())
abc='abcdefghih'
L=[]
def dfs(i,a,s):
    if i==n:
        L.append(s)
    else:
        for j in range(0,a+1):
            dfs(i+1,j+1,s+abc[j])
dfs(0,0,'')
L.sort()
for l in L:
    print(l)
N=int(input())
ans = []
def same(c,mc):
    if len(c)==N:
        ans.append(c)
        return
    else:
        for i in range(ord('a'),ord(mc)+2):
            same(c+chr(i),chr(ord(mc)+1))
same('a','a')
for i in ans:
    print(i)
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)
print(al)
n=int(input())

abc='abcdefghijklmnopqrstuvwxyz'

def dfs(keta,s):
  if keta==n:
    global ans
    ans.append(s)
    return

  inx=abc.index(s[-1])
  for i in range(inx+2):
    dfs(keta+1,s+abc[i])

ans=[]
dfs(1,'a')

ans=set(ans)
ans=sorted(ans)
for i in ans:
  print(i)
n = int(input())
s = []
alp = ['a' ,'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

def print_a(n, ind, cnt, s):
  s = s + [alp[ind]]
  if cnt==n-1:
    for i in range(n):
    	print(s[i], end='')
    print()
  else:
    print_a(n, ind, cnt+1, s.copy())
    print_a(n, ind+1, cnt+1, s.copy())

print_a(n, 0, 0, s)
s = ["a","b","c","d","e","f","g","h","i"]
n=int(input())
l = ["a"]

x = 1
while(x <= n):
    ll = l
    l = []
    for i in ll:
        for j in s[:x-1]:
            l.append(i + j)
    l.append("".join(s[:x]))
    x = x + 1
for i in l:
    print(i)
from itertools import combinations_with_replacement as cb

N = int(input())
al = [chr(i) for i in range(97, 97 + 26)]

ans = []
for C in cb(al[:N], N):
    if C[0] != 'a': continue
    X = set(C)
    flag = True
    for i in range(len(X)):
        if chr(i + 97) not in X:
            flag = False
    if flag:
        ans.append(''.join(C))
ans.sort()
print(*ans, sep='\n')
if __name__ == '__main__':
    n = int(input())
    r = lambda n: [''] if n <= 0 else [e + j for e in r(n - 1) for j in [chr(ord('a') + e) for e in range(n)]]
    a = r(n)
    print(a)
n=int(input())
#ans=[]
num=(2**(n-1))
for i in range(num):
    b=(bin(i)[2:].zfill(n))
    tmp=""
    for each in b:
        if each=="0":
            tmp+="a"
        else:
            tmp+="b"
    #ans.append(tmp)
    print(tmp)
#print(ans)
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
n=INT()
ls=list("abcdefghijklmn")
for i in range(n):
    print("a"*(n-1)+ls[i])