CodeEff/ECCO huggingface dataset:
# Original solution
import sys
sys.setrecursionlimit(10**8)

n = int(eval(input()))

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


mx = ord('a')
dfs('a', mx)

# Optimized solution
import sys
sys.setrecursionlimit(10**8)

n = int(eval(input()))

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


mx = ord('a')
dfs('a', mx)
# Original solution
# import bisect
# # import heapq
# # from copy import deepcopy
# # from collections import deque
# # from collections import Counter
# # from itertools import accumulate
# # from itertools import permutations
# import numpy as np
# # import math
# a,b,c = map(int, input().split())
n = int(eval(input()))
# p = list(map(int, input().split()))
lis = []

def dfs(s, var):
    if len(s) == n and s not in lis:
        lis.append(s)
    else:
        for i in range(var):
            dfs(s+chr(ord('a')+i), var)

        dfs(s+chr(ord('a')+var), var+1)


dfs('a', 1)

for i in range(len(lis)):
    print((lis[i]))

# Optimized solution
# import bisect
# # import heapq
# # from copy import deepcopy
# # from collections import deque
# # from collections import Counter
# # from itertools import accumulate
# # from itertools import permutations
# import numpy as np
# # import math
# a,b,c = map(int, input().split())
n = int(eval(input()))
# p = list(map(int, input().split()))


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

        dfs(s+chr(ord('a')+var), var+1)

dfs('a',1)
# Original solution
n = int(eval(input()))

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

for ai in ans:
    print((''.join([chr(ord('a') + x - 1) for x in ai])))

#r = ['a','b','c','d','e','f','g','h','i','j']
#for ai in ans:
#    print(''.join(map(lambda x: str(r[x-1]), ai)))




# Optimized solution
n = int(eval(input()))
ans = []
def dfs(x):
    if len(x) == n:
        print((''.join([chr(ord('a') + i - 1) for i in x])))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])
# Original solution
n = int(eval(input()))
ans = []
def dfs(x):
    if len(x) == n:
        print((''.join([chr(ord('a') + i - 1) for i in x])))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])



# Optimized solution
n = int(eval(input()))
def dfs(x):
    if len(x) == n:
        print((''.join([chr(ord('a') + i - 1) for i in x])))
        return
    for i in range(max(x)+1):
        y = x.copy()
        y.append(i+1)
        dfs(y)
dfs([1])
# Original solution
def main():
    from collections import deque
    from operator import itemgetter
    from string import ascii_lowercase

    N = int(input())

    deq = deque(), deque()
    curr = 0
    deq[curr].append(('a', 0))  # (word,largest_char_index)
    for _ in range(N - 1):
        while deq[curr]:
            word, largest_char_index = deq[curr].popleft()
            for add_char_index in range(largest_char_index + 1 + 1):
                new_word = word + ascii_lowercase[add_char_index]
                deq[curr ^ 1].append(
                    (new_word, max(largest_char_index, add_char_index)))
        curr ^= 1

    print(*map(itemgetter(0), deq[curr]), sep='\n')


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    from string import ascii_lowercase

    N = int(input())

    ans = []

    def dfs(s='a', ma='a'):
        if len(s) == N:
            ans.append(s)
            return

        for c in ascii_lowercase:
            dfs(s + c, max(c, ma))
            if c > ma: break

    dfs()

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
a1 = list("abcdefghij")

n1 = 0
for i in range(n):
    n1 += (n-1)*(10**i)

for i in range(n1 + 1):
    b = list(map(int, list( str(i).zfill(n) )))
    c = [j < n for j in b]
    if not (all(c)):
        continue
    else:
        e = set()
        f = True
        g = 0
        for j in b:
            if j not in e and g == j:
                e.add(g)
                g += 1
            elif j in e:
                continue
            else:
                f = False
                break
        if f:
            d = [a1[j] for j in b]
            print(("".join(d)))

# Optimized solution
n = int(eval(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)))
# Original solution
def f(n, count=0, i=0, lst=[]):
    global ans
    if count == n:
        s = ""
        for j in range(count):
            s += chr(ord("a") + lst[j])
        ans.append(s)
        return
    if i == 0:
        lst.append(i)
        f(n, count + 1, i=i+1, lst=lst)
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j + 1), lst=lst+[j])

import sys
sys.setrecursionlimit(10000)
n = int(eval(input()))
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)

# Optimized solution
def f(n, count=0, i=0, s=""):
    global ans
    if count == n:
        ans.append(s)
        return
    if i == 0:
        f(n, count + 1, i=i+1, s=s+"a")
    else:
        for j in range(i + 1):
            f(n, count + 1, i=max(i, j + 1), s=s+chr(ord("a") + j))

import sys
sys.setrecursionlimit(10000)
n = int(eval(input()))
ans = []
f(n)
ans.sort()
for i in ans:
    print(i)
# Original solution
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

ans = set()
def rec(i, S):
    if S in ans:
        return
    if i == N:
        ans.add(S)
        return
    for c in S:
        rec(i+1, S+c)
    if i == 0:
        rec(i+1, 'a')
    else:
        li = sorted(S)
        rec(i+1, S+chr(ord(li[-1])+1))
rec(0, '')
ans = sorted(ans)
[print(s) for s in ans]


# Optimized solution
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()

ans = set()
def rec(i, S):
    if S in ans:
        return
    if i == N:
        ans.add(S)
        return
    # 今までに出現した文字は全部追加できる
    for c in S:
        rec(i+1, S+c)
    # 今までに出現した中で最大の文字の次も追加できる
    li = sorted(S)
    rec(i+1, S+chr(ord(li[-1])+1))
rec(1, 'a')
ans = sorted(ans)
[print(s) for s in ans]
# Original solution
import collections
N = int(eval(input()))

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

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

print(('\n'.join(result)))

# Optimized solution
import collections

def bfs(N):
    S = "abcdefghij"
    result = []
    deq = collections.deque(["a"])

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

N = int(eval(input()))
ans = bfs(N)
print(('\n'.join(ans)))
# Original solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
s = ["a"]
ord_a = ord("a")
ans = []
from copy import deepcopy
def dfs(s):
    if len(s) == n:
        ans.append("".join(s))
        return   
    max_ord = 0
    for i in s:
        max_ord = max(max_ord, ord(i) - ord_a)
    for j in range(max_ord + 2):
        new_s = deepcopy(s)
        new_s.append(chr(j + ord_a))
        dfs(new_s)
if n == 1:
    print("a")
    sys.exit()
dfs(s)
ans.sort()
for i in ans:
    print(i)
    







# Optimized solution
import sys
input = sys.stdin.readline

n = int(eval(input()))
s = ["a"]
ord_a = ord("a")
ans = []

def dfs(s):
    if len(s) == n:
        ans.append("".join(s))
        return   
    max_ord = 0
    for i in s:
        max_ord = max(max_ord, ord(i) - ord_a)
    for j in range(max_ord + 2):
        new_s = s[:]
        new_s.append(chr(j + ord_a))
        dfs(new_s)
if n == 1:
    print("a")
    sys.exit()
dfs(s)
ans.sort()
for i in ans:
    print(i)
# Original solution
# coding: utf-8
# Your code here!
def solv1():
    n=int(eval(input()))
    
    a=[[]for i in range(n)]
    a[0]=[[0]]
    
    for i in range(n-1):
        b=[]
        for pa in a[i]:
    #        print(pa)
            el=[j for j in set(pa)]
    #        print(el)
            el.append(max(pa)+1)
            for l in el:
                b+=[pa+[l]]
    #    print(i,b)
        a[i+1]=b
    ans=[j for j in a[n-1]]
        #print(i)
    ans=sorted(ans)
    for i in ans:
        print((''.join([chr(j+97) for j in i])))

solv1()


# Optimized solution
# coding: utf-8
# Your code here!
def solv1():
    n=int(eval(input()))
    
    a=[[]for i in range(n)]
    a[0]=[[0]]
    
    for i in range(n-1):
        b=[]
        for pa in a[i]:
    #        print(pa)
            el=[j for j in set(pa)]
    #        print(el)
            el.append(max(pa)+1)
            for l in el:
                b+=[pa+[l]]
    #    print(i,b)
        a[i+1]=b
    ans=[j for j in a[n-1]]
        #print(i)
    #ans=sorted(ans)
    for i in ans:
        print((''.join([chr(j+97) for j in i])))

solv1()
# Original solution
from collections import deque
D1 = {i:chr(i+96) for i in range(1,27)}
D2 = {val:key for key,val in list(D1.items())}

N = int(eval(input()))
heap = deque([(D1[1],1)])
A = []
while heap:
    a,n = heap.popleft()
    if n<N:
        imax = 0
        for i in range(len(a)):
            imax = max(imax,D2[a[i]])
        for i in range(1,min(imax+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]))

# Optimized solution
from collections import deque
D1 = {i:chr(i+96) for i in range(1,27)}
D2 = {val:key for key,val in list(D1.items())}
N = int(eval(input()))
que = deque([("a",1)])
A = []
while que:
    x,n = que.popleft()
    if n<N:
        imax = 0
        for i in range(len(x)):
            imax = max(imax,D2[x[i]])
        for j in range(1,min(imax+1,26)+1):
            que.append((x+D1[j],n+1))
    else:
        A.append(x)
A = sorted(list(set(A)))
for i in range(len(A)):
    print((A[i]))
# Original solution
import itertools
def solve():
    N = int(eval(input()))
    alphabets = ['a','b','c','d','e','f','g','h','i','j']
    lst = []
    dfs(1, N, alphabets[:N],lst, "", 0)

def dfs(depth, N, alphabets, lst, now, mx):
    if depth > N:
        lst.append(now)
        print(now)
        return
    for i in range(0,mx+1):
        next_mx = mx
        if i == mx:
            next_mx += 1
        dfs(depth+1, N, alphabets, lst, now + alphabets[i], next_mx)

if __name__ == '__main__':
    solve()

# Optimized solution
def solve():
    N = int(eval(input()))
    dfs("", 0, N)

def dfs(cur, n_type, N):
    if len(cur) == N:
        print(cur)
        return
    
    for offset in range(n_type+1):
        next_chr = chr(ord('a') + offset)
        next_n_type = n_type + 1 if offset==n_type else n_type
        dfs(cur+next_chr, next_n_type, N)
    
    return
if __name__ == '__main__':
    solve()
# Original solution
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

    rec(0, 0, 'a')

if __name__ == '__main__':
    resolve()


# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

    rec(0, 0, '')

if __name__ == '__main__':
    resolve()
# Original solution
n = int(eval(input()))


from itertools import product
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'

def dfs(ans, i):
    if len(ans) == n:
        print(("".join(ans)))
        return
    for j in range(i+1):
        dfs(ans+ascii_lowercase[j], max(j+1, i))

dfs("", 0)

# Optimized solution
n = int(eval(input()))

ansl = []
def dfs(s, max_s):
    if len(s) == n:
        ansl.append(s)
        return
    ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
    for i in range(max_s+1):
        dfs(s+ascii_lowercase[i], max(i+1, max_s))

dfs("", 0)
for a in ansl:
    print(a)
# Original solution
n = int(eval(input()))
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
def dfs(res, i):
    if len(res) >= n:
        print(res)
        return
    for k in range(i):
        dfs(res+l[k], i)
    dfs(res+l[i], i+1)
dfs("", 0)

# Optimized solution
n = int(eval(input()))
l = "abcdefghij"
def dfs(res, i):
    if len(res) >= n:
        print(res)
        return
    for k in range(i):
        dfs(res+l[k], i)
    dfs(res+l[i], i+1)
dfs("", 0)
# Original solution
import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))

def get_right(S):
    alpha_idx = 0
    for i in range(len(S)):
        flag = S.find(alpha[i])
        if flag > 0:
            alpha_idx = i
    return alpha_idx + 2


def dfs(S, num):
    if len(S) == N:
        ans.append(S)
    else:
        right = num + 2
        seq = alpha[:right]
        for i, c in enumerate(seq):
            dfs(S+c, max(i, num))

dfs("a", 0)
ans = sorted(ans)
for a in ans:
    print(a)

# Optimized solution
import sys
sys.setrecursionlimit(10**8)
alpha = "abcdefghij"
ans = []
N = int(eval(input()))

def dfs(S, num):
    if len(S) == N:
        ans.append(S)
    else:
        right = num + 2
        seq = alpha[:right]
        for i, c in enumerate(seq):
            dfs(S+c, max(i, num))

dfs("a", 0)
ans = sorted(ans)
for a in ans:
    print(a)
# Original solution
import sys
sys.setrecursionlimit(10 ** 6)


N = int(input())
ans = set()
a = ord('a')


def f(c, A, done):
    global N, a
    B = list(A)
    done = set(done)
    for i in range(N):
        if i not in done:
            B[i] = c
            done.add(i)
            break
    if len(done) == N:
        ans.add(''.join(B))
    else:
        for i in range(2 ** (N - len(done)) - 1, -1, -1):
            k = i
            C = B[:]
            tDone = set(x for x in range(N))
            nDone = set(x for x in done)
            for t in done:
                tDone.remove(t)
            while k > 0:
                y = min(tDone)
                if k & 1 == 1:
                    C[y] = c
                    nDone.add(y)
                tDone.remove(y)
                k >>= 1
            f(chr(ord(c) + 1), tuple(C), tuple(nDone))


A = [0] * N
f('a', tuple(A), ())
ans = list(ans)
ans.sort()
print(*ans, sep='\n')


# Optimized solution
import sys
sys.setrecursionlimit(10 ** 6)


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


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


dfs('a', 0)
print(*ans, sep='\n')
# Original solution
n=int(eval(input()))
ans=[]
def rec(i,s):
    if i == n:
        ans.append(s)
        return True
    else:
        if len(set(s)) == 1:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
        if len(set(s)) == 2:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
        if len(set(s)) == 3:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
        if len(set(s)) == 4:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
        if len(set(s)) == 5:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
        if len(set(s)) == 6:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
        if len(set(s)) == 7:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
        if len(set(s)) == 8:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
        if len(set(s)) == 9:
            rec(i+1,s+"a")
            rec(i+1,s+"b")
            rec(i+1,s+"c")
            rec(i+1,s+"d")
            rec(i+1,s+"e")
            rec(i+1,s+"f")
            rec(i+1,s+"g")
            rec(i+1,s+"h")
            rec(i+1,s+"i")
            rec(i+1,s+"j")
rec(1,"a")
print(("\n".join(ans)))    
        

# Optimized solution
n=int(eval(input()))
ans=[]
def rec(i,s):
    if i == n:
        print(s)
        return
    else:
        for j in range(len(set(s)) + 1):
            rec(i+1,s+chr(ord("a")+j))
rec(1,"a")
# Original solution
N = int(eval(input()))

def dfs(n,i,s,ans):
    if n == N:
        ans.append(s)
        return
    
    for j in range(i+1):
        tmp = s + chr(j + 97)
        max_j = ord(max(tmp)) - 96
        dfs(n+1,max_j,tmp,ans) 
    

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


    


if __name__ == "__main__":
    main()

# Optimized solution
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(eval(input()))
    ans = []
    dfs('a',0,1,N,ans)
    ans.sort()
    for a in ans:
        print(a)


if __name__ == "__main__":
    main()
# Original solution
import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))
ls = []


def dfs(s):
    if len(s) == n:
        ls.append(s)
        return 0
    else:
        for x in map(chr, list(range(97, ord(max(s))+2))):
            dfs(s+x)


dfs("a")
ls.sort()
for x in ls:
    print(x)


# Optimized solution
import sys
sys.setrecursionlimit(10**7)
n = int(eval(input()))

def dfs(s):
    if len(s) == n:
        print(s)
    else:
        for x in map(chr, list(range(97, ord(max(s))+2))):
            dfs(s+x)


dfs("a")
# Original solution
import itertools
n = int(eval(input()))
l = [i for i in range(1, n+1)]
alpha_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
  alpha_dict[i+1] = chr(c)

ans = set()
for v in itertools.product(list(range(1, n+1)), repeat=n):
  m = min(v)
  used = []
  dic = {i:0 for i in range(n+1)}
  tmp = ""
  for u in v:
    if dic[u] == 0:
      dic[u] = len(used)+1
      used += [u]
      tmp += str(alpha_dict[dic[u]]).lower()
    else:
      tmp += str(alpha_dict[dic[u]]).lower()
  ans.add(tmp)

ans = sorted(list(ans))
for v in ans:
  print(v)



# Optimized solution
n = int(eval(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+2):
      dfs(s+alpha_dict[i], max(i, mx), ans)

dfs("", -1, ans)
ans = sorted(ans)
for a in ans:
  print(a)
# Original solution
import itertools
alp = [chr(ord('a') + i) for i in range(26)]
N = int(eval(input()))
allS = list(itertools.product(alp[0:N], repeat=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)))

# Optimized solution
n = int(eval(input()))

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

dfs('', 0)
# Original solution
n=int(eval(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(sorted(list(ans[c]))[-1])
        for m in range(From+2):
            ans.append(ans[c]+char[m])
    #print(ans)
    
b=[]

for g in range(len(ans)):
    if len(ans[g])==n:
        b.append(ans[g])

b.sort()

for i in range(len(b)):
    print((b[i]))

# Optimized solution
import sys
sys.setrecursionlimit(10**9)

N = int(eval(input()))

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

	for i in range(97,ord(m)+2):
		if chr(i) > m:
			bfs(s+chr(i), cnt+1, chr(i))
		else:
			bfs(s+chr(i), cnt+1, m)

bfs('a',1,'a')
# Original solution
import sys
sys.setrecursionlimit(10**9)

N = int(eval(input()))

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

	for i in range(97,ord(m)+2):
		if chr(i) > m:
			bfs(s+chr(i), cnt+1, chr(i))
		else:
			bfs(s+chr(i), cnt+1, m)

bfs('a',1,'a')

# Optimized solution
def dfs(cnt, s, now):
    if cnt == n:
        ans.append(s)
        return
    for i in range(now+1):
        dfs(cnt+1, s+al[i], max(i+1, now))

n = int(eval(input()))
ans = []
al = [chr(i) for i in range(97, 97+26)]
dfs(0, "", 0)
for i in ans:
    print(i)
# Original solution
n = int(input())
lets = [chr(i) for i in range(ord("a"), ord("a") + n)]
d = {e: i for i, e in enumerate(lets)}

s = ["a"]
for i in range(1, n):
    nxt = []
    for e in s:
        mx = 0
        for l in e:
            mx = max(mx, d[l])
        for j in range(mx + 2):
            nxt.append(e + lets[j])
    s = nxt

print(*s, sep="\n")


# Optimized solution
n = int(input())

lets = [chr(i) for i in range(ord("a"), ord("z") + 1)]
ans = []


def dfs(s, l, mx):
    if l == n:
        ans.append(s)
        return

    for i in range(mx + 2):
        dfs(s + lets[i], l + 1, max(mx, i))


dfs("", 0, -1)
print(*ans, sep="\n")