






'''simple docstring'''






class a_    :







   def __init__(self					,   __a)			->      List[str]:
      """simple docstring"""






      __snake_case				:      Optional[Any]     							= val
      __snake_case				:      Optional[Any]     							= None
      __snake_case				:      Tuple     							= None







   def     SCREAMING_SNAKE_CASE__					(self					,   __a)			->      int:
      """simple docstring"""






      if self.val:
         if val < self.val:
            if self.left is None:
               __snake_case				:      List[Any]     							= Node(__a)
            else:
               self.left.insert(__a)
         elif val > self.val:
            if self.right is None:
               __snake_case				:      Optional[int]     							= Node(__a)
            else:
               self.right.insert(__a)
      else:
         __snake_case				:      Optional[int]     							= val




def        _SCREAMING_SNAKE_CASE  (				A  :       List[Any]  ,		A  :       str  )    -> Optional[int]:







   """simple docstring"""
   # Recursive traversal
   if root:
      inorder(root.left  ,		A  )
      res.append(root.val  )
      inorder(root.right  ,		A  )




def        _SCREAMING_SNAKE_CASE  (				A  :       Dict  )    -> str:







   """simple docstring"""
   # Build BST
   if len(A  ) == 0:
      return arr
   __snake_case				:      str     							= Node(arr[0]  )
   for i in range(1  ,		len(A  )  ):
      root.insert(arr[i]  )
   # Traverse BST in order.
   __snake_case				:      Union[str, Any]     							= []
   inorder(A  ,		A  )
   return res


if __name__ == "__main__":
      print(tree_sort([1_0, 1, 3, 2, 9, 1_4, 1_3]))







'''simple docstring'''






import math




class a_    :







   def __init__(self					,   __a=0)			->      Any:  # a graph with Node 0,1,...,N-1
      """simple docstring"""






      __snake_case				:      List[str]     							= n
      __snake_case				:      Tuple     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # adjacency matrix for weight
      __snake_case				:      Union[str, Any]     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # dp[i][j] stores minimum distance from i to j







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a)			->      Tuple:
      """simple docstring"""






      __snake_case				:      Union[str, Any]     							= w







   def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
      """simple docstring"""






      for k in range(0					,   self.n):
         for i in range(0					,   self.n):
            for j in range(0					,   self.n):
               __snake_case				:      List[Any]     							= min(self.dp[i][j]					,   self.dp[i][k] + self.dp[k][j])







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a)			->      Optional[int]:
      """simple docstring"""






      return self.dp[u][v]


if __name__ == "__main__":
      __A    	=   Graph(5)
      graph.add_edge(0, 2, 9)
      graph.add_edge(0, 4, 1_0)
      graph.add_edge(1, 3, 5)
      graph.add_edge(2, 3, 7)
      graph.add_edge(3, 0, 1_0)
      graph.add_edge(3, 1, 2)
      graph.add_edge(3, 2, 1)
      graph.add_edge(3, 4, 6)
      graph.add_edge(4, 1, 3)
      graph.add_edge(4, 2, 4)
      graph.add_edge(4, 3, 9)
      graph.floyd_warshall()
      graph.show_min(1, 4)
      graph.show_min(0, 3)