peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    n = int(input())
    if n == 1:
        print("a")
    else:
        for i in range(2 ** (n - 1)):
            bin_i = bin(i)[2:].zfill(n - 1)
            answer = "a"
            for b in bin_i:
                if b == "0":
                    answer += "a"
                else:
                    answer += "b"
            print(answer)


if __name__ == '__main__':
    main()
N = int(input())
W = 'abcdefghij'
ans = set()

for i in range(1,N+1):
  if i == 1:
    ans.add('a')
  else:
    tmp = set()
    for a in ans:
      index = W.index(sorted(list(a))[-1])
      for i in range(index+2):
        tmp.add(a+W[i])
    ans = tmp
    
for a in ans:
  print(a)
#coding: utf-8

n = int(input())

def f(level):
    if level == 1:
        return ["a"]
    ret = []
    for x in f(level-1):
        for c in range(ord("a"), ord(x[-1])+2):
            ret.append(x + chr(c))
    return ret

print("\n".join(f(n)))
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))]
print(*s, sep='\n')
n=int(input())
def dfs():
  todo=[[1]]
  ret=[]
  while len(todo)>0:
    t=todo.pop()
    if len(t)==n:
      ret.append(t)
    else:
      t.append(t[-1])
      todo.append(t)
      tc=t.copy()
      tc[-1]+=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)))
n = int(input())
lst = []
abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
for i in range(n):
    lst_ = lst
    lst = []
    for s in lst_:
        for j in range(10):
            if s[-1] == abc[j - 1]:
                break
            else:
                lst.append(s + abc[j])
for s in lst:
    print(s)
n = int(input())

alp = [chr(i) for i in range(97, 97+26)]

def dfs(i):
    if i == 1:
        return [("a", 1)]
    else:
        ret = []
        for i in dfs(i-1):
            nowstr, nowmax = i
            for j in range(nowmax+1):
                ret.append((nowstr+alp[j], max(j,nowmax)))
        return ret

ans = dfs(n)
#print(ans)
for i in range(len(ans)):
    print(ans[i][0])
N=int(input())

char="abcdefghijklmnopqrstuvwxyz"

def print_nth(base,n,prev_cnt):
    global char, N
    for i in range(n):
        if (i<=prev_cnt+1):
            str_n = base + char[i]
            if (n==N):
                print(str_n)
            elif (N>n):
                print_nth(str_n, n+1, i)

print_nth("",1,0)
n=int(input())
m=n
a=["a","b","c","d","e","f","g","h","i"]
for i in range(97,97+n+1):
  ans_l=a[:n-m]
  if m>1:
    for j in range(2**(m-1)-1):
      ans=[chr(i)]*m
      for k in range(m):
        if (j>>k)&1:
          ans[m-1-k]=chr(i+1)
      print("".join(ans_l+ans))
  elif m==1:
    print("".join(ans_l+[chr(i)]))
  m-=1
n = int(input())
for i in range(n):
    res = [0] * (n-i) + list(range(1,i+1))
    res = list(map(lambda x: chr(ord("a") + x), res))
    print("".join(res))
N = int(input())

chars = [chr(i) for i in range(ord('a'), ord('z')+1)]


def dfs(s):
    if len(s) == N:
        print(s)
        return
    
    end = s[-1]
    end_i = chars.index(end)
    for i in range(end_i + 2):
        ns = s + chars[i]
        # print('-', i, ns)
        dfs(ns)

dfs('a')
# -*- coding: utf-8 -*-
a = int(input())

l = 1
cur_ret = [[0]]
while l < a:
    new_ret = []
    na = new_ret.append
    for i in cur_ret:
        for j in range(i[-1]+2):
            na(i+[j])
    cur_ret = new_ret
    l+=1

def format(x):
    x = list(map(lambda x : chr(x+97),x))
    return "".join(x)

cur_ret.sort()
for i in cur_ret:
    print(format(i))
n=int(input())
l = ['a','b','c','d','e','f','g','h','i','j','k','l']
arr = ['a']
for i in range(2,n+1):
    temp = []
    for x in l[:i]:
        for y in arr:
            temp.append(y+x)
    arr = temp
for x in arr:
    print(x)
from collections import deque
D1 = {i:chr(i+96) for i in range(1,27)}
D2 = {val:key for key,val in D1.items()}

N = int(input())
heap = deque([(D1[1],1)])
A = []
while heap:
    a,n = heap.popleft()
    if n<N:
        j = D2[a[-1]]
        for i in range(1,min(j+1,26)+1):
            heap.append((a+D1[i],n+1))
    if n==N:
        A.append(a)
A = sorted(list(set(A)))
for i in range(len(A)):
    print(A[i])
from functools import reduce
from itertools import product
n = int(input())

alphabet = "abcdefghij"
ans = ["a"]

for i in range(1, n):
	ans = [a + b for a, b in product(ans, alphabet[:(i + 1)])]

print(*ans, sep = "\n")
from itertools import permutations

N = int(input())
ans = []
S = set()

for p in permutations(range(N)):
    D = [-1] * N
    A = []
    for i in range(N):
        for j in range(N):
            if D[j] < p[i]:
                D[j] = p[i]
                A.append(j)
                break
    s = ''.join(map(lambda x:chr(x+97),A))
    if s not in S:
        print(s)
        S.add(s)
import itertools
alp = [chr(ord('a') + i) for i in range(26)]
N = int(input())
allS = list(itertools.combinations_with_replacement(alp[0:N], N))
answers = []
PatternList = []
for s in allS:
    pattern = []
    letters = []
    num = 0
    for l in s:
        if not(l in letters):
            letters.append(l)
        pattern.append(letters.index(l))
    if not(pattern in PatternList):
        PatternList.append(pattern)
        answers.append(s)
for answer in answers:
    print(''.join(answer))
import sys
sys.setrecursionlimit(10**9)

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)
import sys
sys.setrecursionlimit(10**7)
N = int(input())
N -= 1

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


def dfs(s, depth, maxS):

    if depth == N:
        print(s)
        return

    for i in range(maxS+1):
        if i == maxS:
            dfs(s + S[i], depth+1, i+1)
        else:
            dfs(s + S[i], depth+1, i)


dfs("a", 0, 1)
MOD = 10 ** 9 + 7
INF = 10 ** 11
import sys
sys.setrecursionlimit(100000000)

N = int(input())
ans = []
def dfs(i,standard):
    if i == N:
        ans.append(standard)
        return
    for j in range(97,ord(standard[-1]) + 2):
        dfs(i + 1,standard + chr(j))
dfs(1,'a')
print('\n'.join(ans))
n = int(input())

L = [0]*n
for i in range(n):
    L[i] = chr(i+ord('a'))
#print(L)_

ans = []
def dfs(A):
    if len(A) == n:
        ans.append(''.join(A))
        return
    for v in L[0:len(A)+1]:
        A.append(v)
        dfs(A)
        A.pop()

dfs([])
ans.sort()
for i in range(len(ans)):
    print(ans[i])
n = int(input())
def dfs(d, val, alp):
    if d == n:
        alp.append(val)
        return
    for i in range (ord('a'), ord(val[-1]) + 2):
        nval = val + chr(i)
        dfs(d+1, nval , alp)

alp = []
dfs(1, 'a', alp)
for i in range(len(alp)):
    print(alp[i])
n = int(input())
if n == 1:
    print("a")
if n == 2:
    print("aa")
    print("ab")
elif n == 3:
    print("aaa")
    print("aab")
    print("abb")
    print("abc")
elif n == 4:
    print("aaaa")
    print("aaab")
    print("aabb")
    print("abbb")
else:
    print("hoge")
import itertools
n = int(input())
l = [0 for i in range(n)]
def print_from_l(l):
    print(''.join(map(lambda s:chr(97+s), l)))
for s in itertools.combinations_with_replacement(range(n), n):
    isValid = True
    if s[0] > 0:
        isValid = False
    for i in range(1, len(s)):
        if s[i] - s[i-1] > 1:
            isValid = False
    if isValid:
        print_from_l(s)
N = int(input())

s = []

A = "abcdefghijklmnopqrstuvwxyz"

def ss(n):
    if n == 1:
        return [[0]]
    tt = ss(n-1)
    res = []
    for t in tt:
        for i in range(t[-1]+2):
            res.append(t + [i])
    return res

for s in ss(N):
    S = ''.join([A[i] for i in s])
    print(S)
import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(input())

def dfs(S):
    if len(S) == N:

        ans.append(S)
    else:
        right = min(alpha.find(S[-1])+2, (len(S)+1))
        seq = alpha[:right]
        for c in seq:
            dfs(S+c)
    return

dfs("a")
ans = sorted(ans)
for a in ans:
    print(a)
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.sort()
for row in res:
    print(row)
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
from collections import deque
N = int(input())

s = 'a'
queue = deque()
queue.append(s)
# for i in range(N):
while True:
    a = queue.popleft()
    if len(a) == N:
        queue.append(a)
        break
    origin = a
    a = a[-1]
    end = chr(ord(a)+2)
    while a != end:
        queue.append(origin+a)
        a = chr(ord(a)+1)
ans = []
while queue:
    ans.append(queue.popleft())
for s in sorted(ans):
    print(s)
n=int(input())

A=["aa","ab"]
num2alpha = lambda c: chr(c+64)
B=[]
num2alpha(3)
if n==1:
	print("a")
	exit()
if n==2:
	print("aa")
	print("ab")
	exit()
X=['a','b','c','d','e','f','g','h','i','j']
for l in range(n-2):
	k=l+3
	for s in A:
		for m in range(n):
			B.append(s+X[m-1])
		if s[-1]!= "a":
			B.append(s+chr(ord(s[-1])+1))
	A=A+B
	B=[]
for x in A:
	if len(x)==n:
		print(x)
n=int(input())

tree = [[0,1]]
for _ in range(n-1):
    tree = [ t+[i]  for t in tree for i in range(1,t[-1]+2) ]
tree.sort()
for t in tree:
    print( "".join([chr(ord("a")+tt-1) for tt in t[1:] ] ) )
N = int(input())
ans = ['a']
moji = ['a','b','c','d','e','f','g','h','i','j']
count = 1
while count < N:
    tmp = []
    for i in ans:
        for k in range(len(set(list(i)))+1):
            tmp.append(i+moji[k])
    count += 1
    ans = tmp
print(sorted(ans))
n = int(input())
ans = ["a"]
for i in range(n-1):
    tmp = [a + chr(ord("a")+j) for j in range(i+2) for a in ans]
    ans = tmp

ans.sort()
for a in ans:
    print(a)
# 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)

print("aaaa \
aaab\
aaba\
aabb\
aabc\
abaa\
abab\
abba\
abbb\
abbc\
abca\
abcb\
abcc\
abcd")
n = int(input())

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

dfs(0,s[0])
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def dfs(m, N):
    if N == 0:
        yield []
    else:
        for i in range(0, m+1):
            for solution in dfs(m+1, N-1):
                yield [i]+solution

def solve():
    '''
    a
    '''
    N = read_int()
    alphabets = 'abcdefghij'
    for solution in dfs(0, N):
        print(''.join(alphabets[i] for i in solution))


if __name__ == '__main__':
    solve()
N = int(input())
l = set()

for i in range(N**2):
  pattern = [True] * N
  
  for j in range(N):
    if ((i>>j) & 1):
      pattern[j] = False
   
  o = ord('a')
  t = ''
  for n in range(N):
    if pattern[n]:
      t += 'a'
    else:
      t += chr(o)
      o += 1
      
  l.add(t)
  
l = list(l)  
l.sort()

for ans in l:
  print(ans)
n = int(input())

s = ['a']*(n)
#print(''.join(s))

def dfs(x,alp):
    if x == n:
        print(''.join(s))
        return
    
    for i in range(alp+1):
        #print(x,alp,i)
        s[x] = chr(i+ord("a"))
        dfs(x+1,min(i+1,alp+1))
        #print(alp)


dfs(0,0)
n = int(input())
if n == 1:
    print('a')
if n == 2:
    print('aa')
    print('ab')
if n == 3:
    print('aaa')
    print('aab')
    print('aba')
n = int(input())


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


f('a')
n=int(input())
char=[chr(i) for i in range(97, 97+26)]

ans=["a"]
before=0

for i in range(2,n+1):
    for c in range(len(ans)):
        From=char.index(ans[c][-1])
        for m in range(From+2):
            ans.append(ans[c]+char[m])
    #print(ans)
    
for g in range(len(ans)):
    if len(ans[g])==n:
        print(ans[g])
from itertools import combinations_with_replacement,product
N=int(input())
X=['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']
Z=list(combinations_with_replacement(X,N))

for i in Z[:N]:
    print(*i, sep='')
n = int(input())


def dfs(n, s):
    l = len(s)
    if n == l:
        print(s)
        return
    alpha = "abcdefghijklmnopqrstuvwxyz"
    for i in range(l + 1):
        dfs(n, s + alpha[i])


dfs(n, "")
alf = list("abcdefghijklmnopqrstuvwxyz")

n = int(input())

ans = ["" for i in range(n)]

for i in range(n):
    for j in range(n):
        if j >= i:
            ans[j] += alf[i]
        else:
            ans[j] += alf[j]

print(*ans, sep="\n")
N = int(input())

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

old = ["a"]
new = []
for i in range(1, N):
    for word in old:
        for j in range(i+1):
            if word[-1] == dic[j] or word[-1] == dic[j-1]:
                new.append(word+dic[j])
    old = new.copy()
    new = []
for i in old:
    print(i)
n = int(input())
q = ["0"]
cnt = 0
while cnt < n - 1:
    qt = []
    for num in q:
        lastnum = num[-1]
        for i in range(int(lastnum) + 2):
            qt += [num + str(i)]
    q = qt.copy()
    cnt += 1
    
alp = "abcdefghijkl"
    
def show(num):
    ret = ""
    l = len(num)
    for i in range(l):
        ret += alp[int(num[i])]
    return ret

for num in q:
    print(show(num))
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**5)
to = "abcdefghij"


def dfs(s, p):
    if len(s) == n:
        print(s)
        return
    if p - 1 >= 0:
        dfs(s + to[p - 1], p - 1)
    if p >= 0:
        dfs(s + to[p], p)
    dfs(s + to[p + 1], p + 1)


n = int(input())
dfs("", -1)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  def dfs(s):
    if len(s) == n:
      print(s)
      return
    for i in range(ord('a'), ord(s[-1])+2):
      dfs(s + chr(i))
  dfs('a')
      
if __name__=='__main__':
  main()
base='bcdefghij'
n=int(input())
ans=[]
for i in range(1,n+1):
  tmp='a'*i+base[:n-i]
  ans.append(tmp)
ans=sorted(ans)
for s in ans:
  print(s)
n = int(input())
a = [97] * n
i = n-1
while i >= 0:
  print("".join(list(map(chr, a))))
  a[i] += 1
  i -= 1
N = int(input())
import copy

def nex(lis,i):
    li = copy.copy(lis)
    if len(li) == N:
        print(''.join([chr(97+i) for i in li]))
        return 

    for x in range(li[-1]+2):
        li2 = copy.copy(li)
        li2.append(x)
        nex(li2, i+1)
        
nex([0],0)
n = int(input())
anstmp = ["a"]
cnt = 0
for i in anstmp:
  t = ord(i[-1])-95
  if cnt > 100000:
    break
  for j in range(1,t+1):
    anstmp.append(i+chr(j+96))
  cnt += 1
for i in anstmp:
  if len(i) == n:
    print(i)
import itertools
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
N = int(input())
cnt = 0
c = itertools.product(alp[:N], repeat=N)
for j in c:
    if alp[:len(set(j))] != sorted(list(set(j))):
        continue
    print(''.join(j))
    if list(j) == alp[:len(j)]:
        break
def main():
  n = int(input())
  li  = []
  li.append(["a"])
  for i in range(9):
    x = li[i]
    y = []
    for j in x:
      y.append(j + "a")
      y.append(j + "b")  
    y.sort()
    li.append(y)
  ans = li[n-1]
  for i in ans:
    print(i)  

if __name__ == '__main__':
  main()
N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
for i in range(min(N, 26)):
    s = 'a'*(N-i)
    for j in range(i):
        s+=alp[j+1]
    print(s)
import sys
#input = sys.stdin.buffer.readline

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

    use = [""]
    for i in range(1,N+1):
        ans = []
        for st in use:
            for j in range(i):
                s = chr(97+j)
                if i == N:
                    print(st+s)
                else:
                    ans.append(st+s)
        use = ans
   
if __name__ == "__main__":
    main()
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 ans:
    print(i)
# coding: utf-8
# Your code here!
N=int(input())

cand=["a"]

num=97
for i in range(N-1):
    temp=[]
    for item in cand:
        for i in range(max(ord(item[-1])-95,num-97)):
            temp.append(item+chr(i+97))
            num=max(num,i+97)
    cand=temp[:]

for item in cand:
    print(item)
import sys
input = sys.stdin.readline

N = int(input())

s = [[] for _ in range(N)]
a_ord = ord("a")

for i in range(N):
    if i == 0:
        s[0].append("a")
        continue
    for j in s[i - 1]:
        j_last_ord = ord(j[-1])
        for k in range(a_ord, j_last_ord + 2):
            s[i].append(j + chr(k))

ans = s[-1]
ans.sort()

for i in ans:
    print(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(i+1):
        dfs(c+al[k],i+1)
dfs("",0)
N = int(input())
def sub(l, d):
  if d == N:
    s = "".join(["abcdefghijklmnopqrstuvwxyz"[i] for i in l])
    print(s)
    return
  for j in range(d+1):
    sub(l+[j], d+1)
sub([], 0)
import sys
sys.setrecursionlimit(10**7)
n = int(input())

def rec(s, k, len):
    if len >= n:
        print("".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)
def main():
    N = int(input())
    abc = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')
    past = [[0, 'a']]

    for i in range(1, N):
        ns = []
        for s in past:
            for j in range(s[0] + 2):
                ns.append([j, s[1] + abc[j]])
        past = ns
        if i == N - 1:
            for s in past:
                print(s[1])


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

def main():
    N = int(input())
    letterset = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    for i in range(1, N+1):
        iters = itertools.combinations_with_replacement(letterset[:i], N)
        for tmp in iters:
            if len(set(tmp)) == i:
                print(''.join(tmp))

if __name__ == "__main__":
    main()
import sys
sys.setrecursionlimit(10**7)
n = int(input())

def dfs(s):
    if len(s) == n:
        print(s)
    else:
        for x in map(chr, range(97, ord(s[-1])+2)):
            dfs(s+x)

dfs("a")
num = int(input())
word = "a" * num
if (num == 1):
  print(word)
else:
	print(word)	
	print(("a" * (num - 1)) + "b")
import sys
input = sys.stdin.readline

n = int(input())

a_ord = ord('a')

s = ["a"]

ans = []

def dfs(s):
    last_ord = ord(s[-1])
    for i in range(a_ord, last_ord + 2):
        t = s[:]
        t.append(chr(i))
        if len(t) == n:
            ans.append("".join(t))
        else:
            dfs(t)
if n == 1:
    print('a')
else:
    dfs(s)
    ans.sort()
    for w in ans:
        print(w)
from sys import stdin,setrecursionlimit
import string
setrecursionlimit(10**7)
n = int(stdin.readline().rstrip())
alpha = string.ascii_lowercase
from itertools import combinations_with_replacement
kazu = set()
li = [str(i) for i in range(n)]
lin = list(combinations_with_replacement(li, n))
for i in lin:
    s = ''.join(map(str, i))
    point = 0
    for j in s:
        if j in "0123456789":
            s = s.replace(j,alpha[point])
            point += 1
    kazu.add(s)
kazu = list(kazu)
kazu.sort()
for i in kazu:
    print(i)
import sys
sys.setrecursionlimit(100000000)
def dfs(s,n,m,subs):
  if len(subs)==n:
    print(subs)
    return

  for i in range(m+1):
    t = "".join((subs,s[i]))
    dfs(s,n,i+1,t)

s = "abcdefghij"

n = int(input())
s = list(s[:n])
dfs(s,n,1,"a")
n = int(input())


A = ['a']

for i in range(n-1):
    B = A[i:]
    for j in B:
        # A.append("".join(j) + j[-1])
        # A.append("".join(j) + chr(ord(j[-1]) + 1))
        for i in range(ord("a"), ord(j[-1]) + 2):
            A.append("".join(j) + chr(i))
A = sorted(A)
for i in A:
    if len(i) == n:
        print(i)
import sys
sys.setrecursionlimit(10**5+10)
alp = 'abcdefghij'
N = int(input())
ans = []
def an(i,now,s):
    global ans
    if i == N:
        ans.append(s)
    else:
        for j in range(i+1):
            if j > now+1:
                continue
            an(i+1,j,s+alp[j])
        
an(0,0,'')
ans.sort()
for i in ans:
    print(i)
n = int(input())

from itertools import product
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
for bits in product([0, 1], repeat=n):
    if bits[0] == 1:
        continue
    p = 0
    ansl = []
    for bit in bits:
        if bit == 1:
            p += 1
        ansl.append(ascii_lowercase[p])
    print("".join(ansl))
N = int(input())
ans = []
def dfs(tmp,i):
    if i == N:
        ans.append(tmp)
        return
    
    for s in ["a", "b"]:
        dfs(tmp+s, i+1)
    return ans
dfs("a", 1)
for s in ans:
    print(s)
N = int(input())
int2char = {i: chr(i + 96) for i in range(1, 11)}
ans = ['a']
for n in range(2, N+1):
    new_list = []
    for string in ans:
        str_set = set(string)
        for i in range(1, n+1):
            if len(str_set) + 1< i:
                continue 
            new_str = string + int2char[i]
            new_list.append(new_str)
    ans = new_list

print(sorted(ans))
import itertools
n = int(input())
y = [chr(97+i) for i in range(n)]
u = list(itertools.combinations_with_replacement(y, n))
u = u[:(n*n+1)//2]
for i in u:
    print("".join(i))
chars = ['a','b','c','d','e','f','g','h','i','j']
length = int(input())
def cals(words, num, length):
  work = words
  for val in range(0 , num + 1):
    temp = work + chars[val]
    if num + 1 == length:
      print(temp)
    else:
      cals(temp, num + 1, length)
cals('',0 , length)
import string

def dfs(s,n):
    if n == N:
        print(s)
        return
    else:
        # print(s,n)
        for i in range(N-n):
            dfs(string.ascii_lowercase[i]+s,n+1)

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

def dfs(a, used=0):
    if len(a)==n:
        print(''.join(a))
    else:
        for i in range(ord('a'), ord('a')+used+1):
            dfs(a+[chr(i)], used+1)

dfs([], 0)
N = int(input())
w = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


def dfs(s, i):
    if i == N-1:
        ans = ''
        for i in range(N):
            ans += w[int(s[i])]
        print(ans)
    else:
        dfs(s+s[-1], i+1)
        dfs(s+str(int(s[-1])+1), i+1)


x = dfs('0', 0)
import sys
stdin = sys.stdin
from itertools import product
mod = 10**9 + 7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))


n = ni()

for switch in product([0, 1], repeat=n-1):
    a = ord("a")
    #print(switch)
    print("a", end="")
    for i in switch:
        if i == 0:
            print(chr(a), end="")
        else:
            print(chr(a+1), end="")
            a += 1
    print("")
N = int(input())
chrA = ["a", "b"]

def getBin(number):
    ans = list(map(int, bin(number)[2:].zfill(N)))
    strAns = ""
    for i in range(len(ans)):
        strAns += chrA[ans[i]]

    print(strAns)
    return 0

for _ in range(N):
    getBin(_)
N = int(input())

for i in range(N):
    print('a' * (N - 1) + chr(ord('a') + i))
N=int(input())
S="a"
bottom=""
alpha="abcdefghijklmnopqrstuvwxyz"

for i in range(N):
    if i>25:
        bottom=bottom+"z"
    else:
        bottom=bottom+alpha[i]
    S=S+"a"

C=0
S=""
def F(S,loop,N,C):
    for i in range(0,loop):
        if N==C+1:
            print(S+bottom[i])
        else:
            F(S+bottom[i],i+2,N,C+1)
    return None
            
F(S,1,N,C)