CodeEff/ECCO huggingface dataset:
# Original solution
from collections import deque
n=int(eval(input()))

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

q=deque(['a'])

for i in range(n-1):
    qi_ans=[]
    while(len(q)>0):
        qi=q.popleft()
        qiword_maxind=0
        for j in range(len(qi)):
            qi_ans.append(qi+qi[j])
            qij_ind=alpha.index(qi[j])
            if(qiword_maxind<qij_ind):
                qiword_maxind=qij_ind
        else:
            qi_ans.append(qi+alpha[qiword_maxind+1])
    qi_ans=sorted(list(set(qi_ans)))
#    print(qi_ans)
    q.extend(qi_ans)

lenq=len(q)
for i in range(lenq):
    print((q.popleft()))


# Optimized solution
from collections import deque
n=int(eval(input()))

alpha=list('abcdefghijk')

q=deque([])
q.append(alpha[0])

for i in range(1,n):
    qi=deque([])

    while(len(q)>0):
        qij=q.popleft()
        qij_setnum=len(set(list(qij)))
        for j in range(qij_setnum+1):
            qi.append(qij+alpha[j])

    q=qi

q=list(q)
q.sort()
for i in range(len(q)):
    print((q[i]))
# Original solution
n = int(input())
r = 'a',
for _ in range(n - 1):
  r = [s + c for s in r for i, c in enumerate(s + chr(ord(max(s)) + 1)) if c not in s[:i]]
print(*r, sep='\n')


# Optimized solution
n = int(input())
r = 'a',
for _ in range(n - 1):
  r = [s + c for s in r for c in set(s + chr(ord(max(s)) + 1))]
print(*sorted(r), sep='\n')
# Original solution
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')


# Optimized solution
n = int(input())
r = 'a',
for _ in range(n - 1):
  r = [s + c for s in r for c in set(s + chr(ord(max(s)) + 1))]
print(*sorted(r), sep='\n')
# Original solution
from collections import *

def dfs(now):
    if len(now)==N:
        print((''.join(now)))
        return

    for i in range(ord(max(now))-ord('a')+2):
        now.append(alpha[i])
        dfs(now)
        now.pop()

N = int(eval(input()))
alpha = 'abcdefghijklmnopqrstuvwxyz'
dfs(deque(['a']))

# Optimized solution
from collections import *

def dfs(l):
    if len(l)==N:
        print((''.join(l)))
        return
    
    for a in range(ord('a'), ord(max(l))+2):
        l.append(chr(a))
        dfs(l)
        l.pop()
    
N = int(eval(input()))
dfs(deque(['a']))
# Original solution
from collections import *

def dfs(l):
    if len(l)==N:
        print((''.join(l)))
        return
    
    for a in range(ord('a'), ord(max(l))+2):
        l.append(chr(a))
        dfs(l)
        l.pop()
    
N = int(eval(input()))
dfs(deque(['a']))

# Optimized solution
from collections import *

def dfs(q):
    if len(q)==N:
        print((''.join(q)))
        return 
    
    M = 'a'
    
    for qi in q:
        M = max(M, qi)
        
    for i in range(ord(M)-ord('a')+2):
        q.append(alpha[i])
        dfs(q)
        q.pop()

N = int(eval(input()))
alpha = 'abcdefghijklmnopqrstuvwxyz'
dfs(deque(['a']))
# Original solution

N = int(eval(input()))

def dfs(x):
    if len(x) == N:
        s = "".join(chr(v + ord("a")) for v in x)
        print(s)
        return

    val = max(x)
    for i in range(val + 2):
        x.append(i)
        dfs(x)
        x.pop()

dfs([0])


# Optimized solution

N = int(eval(input()))


def func(x):
    if len(x) == N:
        print(("".join(x)))
        return

    last = ord(max(x)) - ord("a") + 1 if x else 0
    for i in range(min(26, last) + 1):
        x.append(chr(ord("a") + i))
        func(x)
        x.pop()


func([])
# Original solution
import math


def div_with_mod(x, y, mod):
    # Fermat's little theorem
    return x*pow(y, mod - 2, mod)


def comb(n, r, mod):
    # calculates C(n,r) with mod (assuming mod is prime)
    nc = n
    for rc in range(1, r):
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod

    return div_with_mod(n, r, mod)


def solve():
    N = int(input())
    # ord("a") Unicode コードポイントを返す
    codepoint = ord("a")

    def dfs(word, dep):
        if len(word) == N:
            return print(word)

        for i in range(dep):
            dfs(word + chr(codepoint+i), dep)

        dfs(word + chr(codepoint+dep), dep+1)

    dfs("a", 1)


# Solve
if __name__ == "__main__":
    solve()


# Optimized solution
def solve():
    N = int(input())
    # ord("a") Unicode コードポイントを返す
    codepoint = ord("a")
 
    # たどるグラフの深さ
    i = 1
    # 標準形文字列とその次の辞書順
    ans = [["a", 1]]
    # 一つづつ潜る
    while i < N:
        # 次の深さをtmpとする
        tmp = []
        # 各ノード
        for w, j in ans:
            # 辞書順で追加していく
            for k in range(j+1):
                if k != j:
                    tmp.append([w + chr(codepoint+k), j])
                # 辞書順のインクリメント
                else:
                    tmp.append([w + chr(codepoint+k), j+1])
        ans = tmp
        i += 1
 
    [print(a[0]) for a in ans]
 
    # Solve
if __name__ == "__main__":
    solve()
# Original solution
from itertools import permutations

N = int(eval(input()))
ans = []

for p in permutations(list(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
    ans.append(tuple(A))

ans = sorted(set(ans))

for a in ans:
    s = ''.join([chr(x+97) for x in a])
    print(s)

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

def f(s):
    if len(s) == N:
        print(s)
        return
    for i in range(97, ord(max(list(s)))+1+1):
        ns = s + chr(i)
        f(ns)

f('a')
# Original solution
from itertools import product
N = int(input())
X = [chr(ord('a') + i) for i in range(N)]
first_presence = {x: i for x, i in zip(X, list(range(N)))}

ans = ['a']
R = ['a']
# 何文字目以降を変更するか
for i in range(1, N):
    nr = []
    for r in R:
        mr = max(r)
        for x in X:
            nr.append(r + x)
            if mr == x:
                break
        nr.append(r + chr(ord(mr) + 1))
    R = nr

ans = list(set(R))
ans.sort()
print(*ans, sep="\n")


# Optimized solution
N = int(input())
X = [chr(ord('a') + i) for i in range(N)]
first_presence = {x: i for x, i in zip(X, list(range(N)))}

R = ['a']
for i in range(1, N):
    next_r = []
    for r in R:
        max_s = max(r)
        for x in X[:first_presence[max_s] + 2]:
            next_r.append(r + x)
    R = next_r

ans = R
ans.sort()
print(*ans, sep="\n")
# Original solution
# 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(set(s)) + 1]:
            result.append(s + c)
    return result


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


if __name__ == "__main__":
    main()


# Optimized solution
# D - String Equivalence
abc = "abcdefghij"


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


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


if __name__ == "__main__":
    main()
# Original solution
from itertools import product

N = int(eval(input()))
added = set()
ans = []
a = [[chr(97+i) for i in range(j)] for j in range(1,N+1)]
for x in product(*a):
    appeared = set('a')
    d = ['a']
    temp = [0]
    for y in x[1:]:
        if y not in appeared:
            appeared.add(y)
            d.append(y)
            temp.append(d.index(y))
        else:
            temp.append(d.index(y))
    t = tuple(temp)
    if t not in added:
        print((''.join(x)))
        added.add(t)

# Optimized solution
def dfs(s,n):
    if len(s) == n:
        print(s)
    else:
        for i in range(len(set(s))+1):
            dfs(''.join([s,chr(97+i)]),n)

N = int(eval(input()))
dfs('a',N)
# Original solution
import copy
def make(n, data):
    out = []
    # print(ord(data[-1]) + 1 - ord("a"))
    key = data[1]
    for i in range(key + 1):
        # print(key)
        out.append([data[0] + chr(ord("a") + i), max(key, i + 1)])
    return out

n = int(eval(input()))
ans = [["a", 1]]
for i in range(1, n):
    tmp = []

    for j in range(len(ans)):
        tmp += make(i + 1, ans[j])
            # print
    if len(tmp) >= 1:
        ans = copy.deepcopy(tmp)
    # print(ans)

for i in ans:
    print((i[0]))

# Optimized solution
def solve(n, s, mx):
    # print(n, s, mx)
    if n == 0:
        print(s)
    else:
        for i in range(mx):
            solve(n - 1, s + chr(ord("a") + i), max(mx, i + 2))

n = int(eval(input()))
solve(n - 1, 'a', 2)
# Original solution
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(eval(input()))
dfs()

# Optimized solution
def dfs(a='', b='a'):
	if len(a) == N:
		print(a)
	else:
		i = 'a'
		while i < b:
			dfs(a + i, b)
			i = chr(ord(i) + 1)
		dfs(a + b, chr(ord(b) + 1))

N = int(eval(input()))
dfs()
# Original solution
import itertools
import bisect

def main():
    N = int(eval(input()))
    letterset = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
    check = []
    for i in range(1, N+1):
        iters = itertools.product(letterset[:i], repeat=N)
        for tmp in iters:
            if len(set(tmp)) == i:
                flag = True
                if tmp[0] != 'a':
                    flag = False
                for k in range(N-1):
                    if not tmp[k+1] in letterset[:len(set(tmp[:k+1]))+1]:
                        flag = False
                if flag:
                    check.append(''.join(tmp))
    check.sort()
    for ans in check:
        print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
import sys

sys.setrecursionlimit(10**7)
strlist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

def dfs(n, before):
    lensetbefore = len(set(before))
    if n == 1:
        print(before)
    if n > 1:
        for s in strlist[:lensetbefore+1]:
            dfs(n-1, before+s)

def main():
    N = int(eval(input()))
    dfs(N, 'a')


if __name__ == "__main__":
    main()
# Original solution
n=int(input())-1
l=[[] for _ in range(10)]
l[0].append('a')
for i in range(n):
  for w in l[i]:
    s = sorted(set(w))
    for c in s:
      l[i+1].append(w+c)
    l[i+1].append(w+chr(ord(s[-1])+1))  
print(*l[n],sep='\n')


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

s = set()

def solve(n):
    global s

    if n == N:
        return

    if len(s) == 0:
        s.add('a')
        solve(n+1)
    else:
        new_s = set()
        for v in s:
            xc = chr(ord(max(v))+1)
            for vc in v:
                new_s.add(v + vc)
                new_s.add(v + xc)
        s = new_s
        solve(n+1)

solve(0)
ans = sorted(s)
print(*ans, sep='\n')


# Optimized solution
N = int(input())

s = {'a'}

def solve(n):
    global s
    if n == N:
        return
    new_s = set()
    for v in s:
        xc = chr(ord(max(v))+1)
        for vc in v:
            new_s.add(v + vc)
            new_s.add(v + xc)
    s = new_s
    solve(n+1)

solve(1)
ans = sorted(s)
print(*ans, sep='\n')
# Original solution
n = int(eval(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(set(A))+1]:
        A.append(v)
        dfs(A)
        A.pop()

dfs([])
ans.sort()
for i in range(len(ans)):
    print((ans[i]))


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

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

dfs([])
ans.sort()
for i in range(len(ans)):
    print((ans[i]))
# Original solution
def cur(n):
    if ans[n]!=[]: return ans[n]
    for x in cur(n-1):
        tmp1=[0]+[x[i] for i in range(n-1)]
        tmp2=[0]+[x[i]+1 for i in range(n-1)]
        ans[n].append(tmp1)
        ans[n].append(tmp2)
        if max(x)!=0:
            for k in range(1,max(x)+1):
                tmp3=[0]+[x[i] for i in range(n-1)]
                for i in range(1,n):
                    if tmp3[i]==k: tmp3[i]=0
                    elif tmp3[i]<k: tmp3[i]+=1
                ans[n].append(tmp3)
    
    return ans[n]

def pri(x):
    s=""
    for i in range(p):
        s+=chr( ord("a")+x[i] )
    print(s)

p=int(eval(input()))
ans=[[] for i in range(11)]
ans[1]=[[0]]
ans[2]=[[0,0],[0,1]]
cur(p)

ans[p].sort()
pri(ans[p][0])
for i in range(1,len(ans[p])):
    if ans[p][i]!=ans[p][i-1]: pri(ans[p][i])


# Optimized solution
n=int(eval(input()))
def cur(x):
    if len(x)==n:
        s="".join([chr( ord("a")+x[i]) for i in range(n)])
        print(s)

    else:
         for i in range(max(x)+2):
             cur(x+[i])

cur([0])
# Original solution
from collections import deque
N = int(eval(input()))

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
unvisited = deque(alphabet[0 : N])
visited = deque()
st = deque([["a", visited, unvisited]]) # stack

while len(st) > 0:
    str, visited, unvisited = st.popleft()

    if str[-1] not in visited:
        visited.append(str[-1])
        unvisited.popleft()

    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in visited:
            st.append([str + x, deque(visited), deque(unvisited)])
        # まだ使っていない文字を使う
        if len(unvisited) > 0:
            x = unvisited[0]
            st.append([str + x, deque(visited), deque(unvisited)])


# Optimized solution
from collections import deque
N = int(eval(input()))

alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])

while len(st) > 0:
    str, visited = st.popleft()

    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in alphabet[0 : visited]:
            st.append([str + x, visited])
        # まだ使っていない文字を使う
        # len(str) < Nだから、visited < N
        st.append([str + alphabet[visited], visited + 1])
# Original solution
from collections import deque
N = int(eval(input()))

alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])

while len(st) > 0:
    str, visited = st.popleft()

    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in alphabet[0 : visited]:
            st.append([str + x, visited])
        # まだ使っていない文字を使う
        # len(str) < Nだから、visited < N
        st.append([str + alphabet[visited], visited + 1])


# Optimized solution
from collections import deque
N = int(eval(input()))

alphabet = "abcdefghij"
visited = 1
st = deque([("a", visited)])

while len(st) > 0:
    str, visited = st.popleft()

    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in alphabet[0 : visited]:
            st.append((str + x, visited))
        # まだ使っていない文字を使う
        # len(str) < Nだから、visited < N
        st.append((str + alphabet[visited], visited + 1))
# Original solution
N = int(eval(input()))


def DFS(N, S):
    if len(S) == N:
        print(S)
    else:
        next_chrs = []
        if S:
            next_max_chr = ord(max(S)) + 1
        else:
            next_max_chr = ord("a")
        for i in range(0, next_max_chr - ord("a") + 1):
            DFS(N, "".join([S, chr(ord("a") + i)]))


DFS(N, "")

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


def DFS(N, S):
    if len(S) == N:
        print(S)
    else:
        if S:
            next_max_chr = ord(max(S)) + 1
        else:
            next_max_chr = ord("a")
        for i in range(0, next_max_chr - ord("a") + 1):
            DFS(N, S + chr(ord("a") + i))


DFS(N, "")
# Original solution
def dfs(n):
    adj = [chr(i+97) for i in range(26)]
    
    stack = ['a']
    while stack:
        node = stack.pop(0)
        if len(node) == n:
            print(node)
        else:
            limit = ord(max(node))%97+2
            for child in adj[:limit]:
                stack.append(node+child)
    return -1

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(eval(input()))
    dfs(n)


if __name__ == '__main__':
    main()

# Optimized solution
def dfs(s,n,adj):
    adj = 'abcdefghij'
    if len(s) == n:
        print(s)
    else:
        for child in adj[:len(set(s))+1]:
            dfs(s+child,n,adj)
    return -1

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(eval(input()))
    adj = 'abcdefghij'
    dfs('a',n,adj)


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
import itertools
from collections import deque
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  
p = [[] for _ in range(N)]
p[0].append('a')
for i in range(1,N):
  for j in r[i]:
    for k in p[i-1]:
      p[i].append(k+j)
      
p = p[-1]
for i in p:
  a = [0]*10
  for j in i:
    x = ord(j)-97
    a[x]=1
    if x==0:
      judge = True
      continue
    elif a[x-1]==1:
      judge = True
      continue
    else:
      judge = False
      break
  if judge:
    ans.append(i)
ans = set(ans)
ans = sorted(list(ans))
for a in ans:
  print(a)

# Optimized solution
N = int(eval(input()))
from collections import deque
import itertools
ans = deque()
l = []
r = deque()
for i in range(N):
  l.append(chr(97+i))
  r.append(l.copy())
  

p = [[[] for _ in range(N)] for _ in range(N)]
p[0][0].append('a')
for i in range(1,N):
  for j in r[i]:
    x = ord(j)-97
    for n,k in enumerate(p[i-1][max(0,x-1):],max(0,x-1)):
      for m in k:
        p[i][max(n,x)].append(m+j)


p = p[-1]
p = list(itertools.chain.from_iterable(p))
p = sorted(p)
for q in p:
  print(q)
# Original solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(str, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *
        
#非再帰バージョン
N = INT()

w = ["a"]

while  w:
    s = w.pop()
    if len(s) == N:
        print(s)
        continue
    else:
        for j in range(len(set(s)), -1, -1):
            t = s+ascii_lowercase[j]
            w.append(t)

# Optimized solution
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(str, input().split()))
def ZIP(n): return list(zip(*(MAP() for _ in range(n))))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *
        
#再帰バージョン
N = INT()

def DFS(n):
    if len(n) == N:
        print(n)
    else:
        for i in range(len(set(n))+1):
            m = n+ascii_lowercase[i]
            DFS(m)

DFS("a")
# Original solution
n = int(eval(input()))

alphabet = 'abcdefghij'
s = [-1 for i in range(n)]
lst = [[] for i in range(n)]
lst[0].append(0)
ind = 0
while lst[ind] != [] or ind > 0:
    if ind < n-1 and lst[ind] != []:
        s[ind] = lst[ind].pop()
        for i in range(max(s)+1, -1, -1):
            lst[ind+1].append(i)
        ind += 1
    else:
        while lst[ind] != []:
            s[ind] = lst[ind].pop()
            ans = [alphabet[i] for i in s]
            print((''.join(ans)))
        s[ind] = -1
        ind -= 1

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

if n == 1:
    print('a')
    exit()

lst = ['a']
for i in range(n-1):
    new_lst = []
    for string in lst:
        num = ord(sorted(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)
# Original solution
def main():
    from string import ascii_lowercase
    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(eval(input()))
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            print(s)
            return
        else:
            for i in range(mx+2):
                v = s + dic[i]
                mx = max(mx, i)
                dfs(v, mx)
    dfs("a", 0)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    from string import ascii_lowercase
    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(input())
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            ans.append(s)
            return
        else:
            for i in range(mx+2):
                v = s + dic[i]
                mx = max(mx, i)
                dfs(v, mx)
    dfs("a", 0)
    print(*ans, sep="\n")


if __name__ == '__main__':
    main()
# Original solution
def main():
    from string import ascii_lowercase
    dic = {i: s for i, s in enumerate(ascii_lowercase)}
    N = int(input())
    ans = []

    def dfs(s, mx):
        if len(s) == N:
            ans.append(s)
            return
        else:
            for i in range(mx+2):
                mx = max(mx, i)
                dfs(s + dic[i], mx)
    dfs("a", 0)
    print(*ans, sep="\n")


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    from string import ascii_lowercase
    N = int(eval(input()))
    ascii_dic = {i: a for i, a in enumerate(ascii_lowercase)}
    ascii_rdic = {a: i for i, a in enumerate(ascii_lowercase)}
    # ans = []

    def dfs(A):
        if len(A) == N:
            # ans.append("".join(A))
            print(("".join(A)))
            return
        if not A:
            dfs(["a"])
        else:
            s = max(ascii_rdic[a] for a in A)
            for i in range(s+2):
                dfs(A + [ascii_dic[i]])

    dfs([])

    # for i in range(len(ans)):
    #     for j in range(i+1, len(ans)):
    #         S = ans[i]
    #         T = ans[j]
    #         same = True  # 同型である
    #         for k in range(N):
    #             for m in range(k, N):
    #                 if not ((S[k] == S[m] and T[k] == T[m]) or
    #                         (S[k] != S[m] and T[k] != T[m])):
    #                     same = False
    #         if same:  # 同型である
    #             print(S, T)


if __name__ == '__main__':
    main()