# 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()

# 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()

# 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()

# 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()

-from string import ascii_lowercase +abc = "abcdefghij" -        for c in ascii_lowercase[: len(set(s)) + 1]: +        for c in abc[: len(set(s)) + 1]: