def solve(s):

    if len(s)==n:

        a.append(''.join(chr(c+97)for c in s))

        return

    for i in range(max(s)+2):

        solve(s+[i])

n=int(eval(input()))

a=[]

solve([0])

print((*a))
a='a'

exec('a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];'*~-int(eval(input())))

print((*a))
def solve(s):
    if len(s) == n:
        a.append("".join(chr(c + 97) for c in s))
        return
    for i in range(max(s) + 2):
        solve(s + [i])


n = int(eval(input()))
a = []
solve([0])
print((*a))

a = "a"
exec("a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];" * ~-int(eval(input())))
print((*a))

-def solve(s): -    if len(s) == n: -        a.append("".join(chr(c + 97) for c in s)) -        return -    for i in range(max(s) + 2): -        solve(s + [i]) - - -n = int(eval(input())) -a = [] -solve([0]) +a = "a" +exec("a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];" * ~-int(eval(input())))