def to_iso(lst):
    chars = set(lst)
    mp = list(chars)
    mp.sort()
    repl = {c: None for c in mp}

    for i in range(len(mp)):
        repl[mp[i]] = chr(97 + i)

    return [repl[c] for c in lst]


def comb(current, rest, target: int):
    if len(current) == target:
        yield current
    elif len(current) < target and len(rest) > 0:
        for i in range(len(current) + 1):
            yield from comb(current + [rest[i]], rest, target)


if __name__ == '__main__':
    n = int(input())
    alphabet = [str(chr(i)) for i in range(97, 97 + 26)]
    result = set()

    for perm in comb([], alphabet[:n], n):
        result.add("".join(to_iso(perm)))

    result = list(result)
    result.sort()
    for r in result:
        print(r)
