def gen_pattern(N, pre=""):

  for c in range(0x61, ord(max(pre or "\x60"))+2):

    pat = pre+chr(c)

    if len(pat) == N:

      yield pat

    else:

      yield from gen_pattern(N, pat)



for pattern in gen_pattern(int(eval(input()))):

  print(pattern)

from string import ascii_lowercase as alph



def gen_pattern(N, pre="", m=0):

  if len(pre)+1 == N:

    for c in alph[:m+1]:

      yield pre+c

  else:

    for c in alph[:m]:

      yield from gen_pattern(N, pre+c, m)

    yield from gen_pattern(N, pre+alph[m], m+1)



for pattern in gen_pattern(int(eval(input()))):

  print(pattern)

def gen_pattern(N, pre=""):
    for c in range(0x61, ord(max(pre or "\x60")) + 2):
        pat = pre + chr(c)
        if len(pat) == N:
            yield pat
        else:
            yield from gen_pattern(N, pat)


for pattern in gen_pattern(int(eval(input()))):
    print(pattern)

from string import ascii_lowercase as alph


def gen_pattern(N, pre="", m=0):
    if len(pre) + 1 == N:
        for c in alph[: m + 1]:
            yield pre + c
    else:
        for c in alph[:m]:
            yield from gen_pattern(N, pre + c, m)
        yield from gen_pattern(N, pre + alph[m], m + 1)


for pattern in gen_pattern(int(eval(input()))):
    print(pattern)

-def gen_pattern(N, pre=""): -    for c in range(0x61, ord(max(pre or "\x60")) + 2): -        pat = pre + chr(c) -        if len(pat) == N: -            yield pat -        else: -            yield from gen_pattern(N, pat) +from string import ascii_lowercase as alph + + +def gen_pattern(N, pre="", m=0): +    if len(pre) + 1 == N: +        for c in alph[: m + 1]: +            yield pre + c +    else: +        for c in alph[:m]: +            yield from gen_pattern(N, pre + c, m) +        yield from gen_pattern(N, pre + alph[m], m + 1)