from __future__ import annotations

from dataclasses import dataclass







@dataclass
class __snake_case				:
   lowerCAmelCase_														=							42
   lowerCAmelCase_														=							None
   lowerCAmelCase_														=							None





def 	__SCREAMING_SNAKE_CASE  (					__UpperCamelCase    :       TreeNode | None	)							->					bool:







  """simple docstring"""





  def is_valid_tree(__UpperCamelCase    :       TreeNode | None	) -> bool:
    if node is None:
      return True

    if not isinstance(_snake_case ,     _snake_case	):
      return False

    try:
      float(node.data	)
    except (TypeError, ValueError):
      return False

    return is_valid_tree(node.left	) and is_valid_tree(node.right	)

  if not is_valid_tree(_snake_case	):
    raise ValueError(
        """Each node should be type of TreeNode and data should be float."""	)

  def is_binary_search_tree_recursive_check(
      __UpperCamelCase    :       TreeNode | None ,     __UpperCamelCase    :       float ,     __UpperCamelCase    :       float	) -> bool:

    if node is None:
      return True

    return (
        left_bound < node.data < right_bound
        and is_binary_search_tree_recursive_check(node.left ,     _snake_case ,     node.data	)
        and is_binary_search_tree_recursive_check(
            node.right ,     node.data ,     _snake_case	)
    )

  return is_binary_search_tree_recursive_check(_snake_case ,     -float("""inf"""	) ,     float("""inf"""	)	)


if __name__ == "__main__":
   import doctest

   doctest.testmod()


from __future__ import annotations





class       _snake_case					:







			def __init__(				self						,   _a		):
				__magic_name__		:		Optional[Any]	   =     data
				__magic_name__		:		Node | None	   =     None
				__magic_name__		:		Node | None	   =     None







def   lowerCAmelCase_						(					_snake_case      :  Node | None   )				->		None:  # In Order traversal of the tree







	'''simple docstring'''


	if tree:
		display(tree.left   )
		print(tree.data   )
		display(tree.right   )






def   lowerCAmelCase_						(					_snake_case      :  Node | None   )				->		int:







	'''simple docstring'''


	return 1 + max(depth_of_tree(tree.left   )      ,   depth_of_tree(tree.right   )   ) if tree else 0






def   lowerCAmelCase_						(					_snake_case      :  Node   )				->		bool:







	'''simple docstring'''


	if not tree:
		return True
	if tree.left and tree.right:
		return is_full_binary_tree(tree.left   ) and is_full_binary_tree(tree.right   )
	else:
		return not tree.left and not tree.right






def   lowerCAmelCase_						(					)				->		None:  # Main function for testing.







	'''simple docstring'''


	__magic_name__		:		int	   =     Node(1   )
	__magic_name__		:		Union[str, Any]	   =     Node(2   )
	__magic_name__		:		Tuple	   =     Node(3   )
	__magic_name__		:		Optional[Any]	   =     Node(4   )
	__magic_name__		:		Union[str, Any]	   =     Node(5   )
	__magic_name__		:		Any	   =     Node(6   )
	__magic_name__		:		int	   =     Node(7   )
	__magic_name__		:		List[str]	   =     Node(8   )
	__magic_name__		:		Union[str, Any]	   =     Node(9   )

	print(is_full_binary_tree(_snake_case   )   )
	print(depth_of_tree(_snake_case   )   )
	print("Tree is: "   )
	display(_snake_case   )


if __name__ == "__main__":
				main()
