def issame(s, t):
    for i in range(len(s)-1):
        for j in range(i+1, len(s)):
            if s[i]==s[j] and t[i] != t[j]:
                return False
            if s[i]!=s[j] and t[i] == t[j]:
                return False
    return True


def hassame(s, l):
    for t in l:
        if issame(s, t):
            return True
    return False


def main():
    import string
    N = int(input())
    ans = []

    ASCII = list(string.ascii_lowercase)
    def rec(n, l):
        if n==N:
            s = "".join(l)
            if not hassame(s, ans):
                ans.append("".join(l))
        else:
            for c in ASCII[:n+1]:
                l.append(c)
                rec(n+1, l)
                l.pop()
    rec(0, [])
    print("\n".join(ans))


if __name__ == '__main__':
    main()
