from string import ascii_lowercase as alph

from operator import itemgetter



def gen_pattern(N, pre=[]):

  for i in range(max(pre or [-1])+2):

    indexes = pre+[i]

    if len(indexes) == N:

      print(("".join(itemgetter(*indexes)(alph))))

    else:

      gen_pattern(N, indexes)



gen_pattern(int(eval(input())))

from string import ascii_lowercase as alph



def gen_pattern(N, pre=""):

  for i in range(ord(max(pre or "\x60"))-0x5f):

    pattern = pre+alph[i]

    if len(pattern) == N:

      print(pattern)

    else:

      gen_pattern(N, pattern)



gen_pattern(int(eval(input())))

from string import ascii_lowercase as alph
from operator import itemgetter


def gen_pattern(N, pre=[]):
    for i in range(max(pre or [-1]) + 2):
        indexes = pre + [i]
        if len(indexes) == N:
            print(("".join(itemgetter(*indexes)(alph))))
        else:
            gen_pattern(N, indexes)


gen_pattern(int(eval(input())))

from string import ascii_lowercase as alph


def gen_pattern(N, pre=""):
    for i in range(ord(max(pre or "\x60")) - 0x5F):
        pattern = pre + alph[i]
        if len(pattern) == N:
            print(pattern)
        else:
            gen_pattern(N, pattern)


gen_pattern(int(eval(input())))

-from operator import itemgetter -def gen_pattern(N, pre=[]): -    for i in range(max(pre or [-1]) + 2): -        indexes = pre + [i] -        if len(indexes) == N: -            print(("".join(itemgetter(*indexes)(alph)))) +def gen_pattern(N, pre=""): +    for i in range(ord(max(pre or "\x60")) - 0x5F): +        pattern = pre + alph[i] +        if len(pattern) == N: +            print(pattern) -            gen_pattern(N, indexes) +            gen_pattern(N, pattern)