'''simple docstring'''




from __future__ import annotations

class 	lowerCamelCase_	:
      '''simple docstring'''

      def __init__(       self						:				Union[str, Any]						,					A						:				int       ):
             _UpperCAmelCase     :  Optional[int]							      =    data
             _UpperCAmelCase     :  Node | None							      =    None
             _UpperCAmelCase     :  Node | None							      =    None

def 	UpperCamelCase_							(					_UpperCAmelCase  :      Tuple    )    ->    List[str]:  # In Order traversal of the tree


       """simple docstring"""







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

def 	UpperCamelCase_							(					_UpperCAmelCase  :      str    )    ->    Dict:


       """simple docstring"""







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

def 	UpperCamelCase_							(					_UpperCAmelCase  :      List[str]    )    ->    Any:


       """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 	UpperCamelCase_							(					)    ->    str:  # Main function for testing.


       """simple docstring"""







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

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


if __name__ == "__main__":
  main()







def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  # Return True if there is node that has not iterated.
  lowercase			:Union[str, Any]							=  [False] * len(lowerCamelCase      )
  lowercase			:Union[str, Any]							=  []
  queue.append(lowerCamelCase      )
  lowercase			:Optional[Any]							=  True

  while queue:
    lowercase			:Optional[Any]							=  queue.pop(0      )
    for ind in range(len(graph[u]      )      ):
      if visited[ind] is False and graph[u][ind] > 0:
        queue.append(lowerCamelCase      )
        lowercase			:Dict							=  True
        lowercase			:Dict							=  u

  return visited[t]



def 					UpperCAmelCase__     (   lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
  # This array is filled by BFS and to store path
  lowercase			:Optional[int]							=  [-1] * (len(lowerCamelCase      ))
  lowercase			:int							=  0
  while bfs(lowerCamelCase,	lowerCamelCase,	lowerCamelCase,	lowerCamelCase      ):
    lowercase			:int							=  float("Inf"      )
    lowercase			:Any							=  sink

    while s != source:
      # Find the minimum value in select path
      lowercase			:Any							=  min(lowerCamelCase,	graph[parent[s]][s]      )
      lowercase			:Dict							=  parent[s]

    max_flow += path_flow
    lowercase			:Union[str, Any]							=  sink

    while v != source:
      lowercase			:List[Any]							=  parent[v]
      graph[u][v] -= path_flow
      graph[v][u] += path_flow
      lowercase			:Any							=  parent[v]
  return max_flow


_UpperCAmelCase		:  Optional[Any]	=   [
    [0, 16, 13, 0, 0, 0],
    [0, 0, 10, 12, 0, 0],
    [0, 4, 0, 0, 14, 0],
    [0, 0, 9, 0, 0, 20],
    [0, 0, 0, 7, 0, 4],
    [0, 0, 0, 0, 0, 0],
]

_UpperCAmelCase	,	_UpperCAmelCase		:  Any	=   0, 5







print(ford_fulkerson(graph, source, sink))



