import string


def canonical(s):
    m = {}
    it = iter(string.ascii_lowercase)
    res = ""
    for c in s:
        if c not in m:
            m[c] = next(it)
        res += m[c]
    return res


def main():
    import string
    N = int(input())
    seen = set()
    ASCII = list(string.ascii_lowercase)
    def rec(n, l):
        if n==N:
            s = "".join(l)
            can = canonical(s)
            if can not in seen:
                seen.add(can)
        else:
            for c in ASCII[:n+1]:
                l.append(c)
                rec(n+1, l)
                l.pop()
    rec(0, [])
    ans = sorted(seen)
    print("\n".join(ans))


if __name__ == '__main__':
    # print(canonical("aacc"))
    # print(canonical("aacb"))
    main()
