# Tree example:
#       10
#      /  \
#     5   15
#    / \    \
#   3   7   20


class Node:
    def __init__(self, value, left=None, right=None):
        self.value = value
        self.left: Node | None = left
        self.right: Node | None = right


root_node = Node(10)
root_node.left = Node(5)
root_node.left.left = Node(3)
root_node.left.right = Node(7)
root_node.right = Node(15)
root_node.right.right = Node(20)


def invert_tree(root: Node | None):
    if root is None:
        return

    invert_tree(root.left)
    invert_tree(root.right)

    root.left, root.right = root.right, root.left


invert_tree(root_node)

print(root_node.left.value)
print(root_node.right.value)
print(root_node.left.left.value)
print(root_node.right.right.value)
print(root_node.right.left.value)
