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

def insert(root, value):
    if root is None: return Node(value)
    if value < root.value: root.left = insert(root.left, value)
    elif value > root.value: root.right = insert(root.right, value)
    return root

def contains(root, target):
    while root is not None:
        if target == root.value: return True
        root = root.left if target < root.value else root.right
    return False

root = None
for n in (8, 3, 10, 1, 6): root=insert(root,n)
assert contains(root,6) and not contains(root,9)
print('BST tests passed')
