






import math





class 		UpperCAmelCase						:





   def __init__(	self       ,     _lowerCAmelCase=0			):  # a graph with Node 0,1,...,N-1
         _lowerCAmelCase 			=  n
         _lowerCAmelCase 			=  [
             [math.inf for j in range(0       ,     lowerCamelCase_			)] for i in range(0       ,     lowerCamelCase_			)
         ]  # adjacency matrix for weight
         _lowerCAmelCase 			=  [
             [math.inf for j in range(0       ,     lowerCamelCase_			)] for i in range(0       ,     lowerCamelCase_			)
         ]  # dp[i][j] stores minimum distance from i to j





   def 	__lowerCAmelCase							(	self       ,     _lowerCAmelCase       ,     _lowerCAmelCase       ,     _lowerCAmelCase			):
         _lowerCAmelCase 			=  w





   def 	__lowerCAmelCase							(	self			):




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





   def 	__lowerCAmelCase							(	self       ,     _lowerCAmelCase       ,     _lowerCAmelCase			):
         return self.dp[u][v]


if __name__ == "__main__":
    UpperCAmelCase_									=							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)




def 							UpperCAmelCase__		(				_SCREAMING_SNAKE_CASE   :	Optional[Any]				)->Any:  # noqa: E741
      _lowerCAmelCase 			=  len(_SCREAMING_SNAKE_CASE				)
      _lowerCAmelCase 			=  0
      _lowerCAmelCase 			=  [0] * n
      _lowerCAmelCase 			=  [False] * n
      _lowerCAmelCase 			=  [False] * n

      def dfs(_SCREAMING_SNAKE_CASE   :	List[str]     ,				_SCREAMING_SNAKE_CASE   :	List[Any]     ,				_SCREAMING_SNAKE_CASE   :	Optional[int]     ,				_SCREAMING_SNAKE_CASE   :	int				):
            if parent == root:
                  out_edge_count += 1
            _lowerCAmelCase 			=  True
            _lowerCAmelCase 			=  at

            for to in l[at]:
                  if to == parent:
                        pass
                  elif not visited[to]:
                        _lowerCAmelCase 			=  dfs(_SCREAMING_SNAKE_CASE     ,				_SCREAMING_SNAKE_CASE     ,				_SCREAMING_SNAKE_CASE     ,				_SCREAMING_SNAKE_CASE				)
                        _lowerCAmelCase 			=  min(low[at]     ,				low[to]				)

                        # AP found via bridge
                        if at < low[to]:
                              _lowerCAmelCase 			=  True
                        # AP found via cycle
                        if at == low[to]:
                              _lowerCAmelCase 			=  True
                  else:
                        _lowerCAmelCase 			=  min(low[at]     ,				_SCREAMING_SNAKE_CASE				)
            return out_edge_count

      for i in range(_SCREAMING_SNAKE_CASE				):
            if not visited[i]:
                  _lowerCAmelCase 			=  0
                  _lowerCAmelCase 			=  dfs(_SCREAMING_SNAKE_CASE     ,				_SCREAMING_SNAKE_CASE     ,				-1     ,				_SCREAMING_SNAKE_CASE				)
                  _lowerCAmelCase 			=  out_edge_count > 1

      for x in range(len(_SCREAMING_SNAKE_CASE				)				):
            if is_art[x] is True:
                  print(_SCREAMING_SNAKE_CASE				)


# Adjacency list of graph
UpperCAmelCase_									=							{
    0: [1, 2],
    1: [0, 2],
    2: [0, 1, 3, 5],
    3: [2, 4],
    4: [3],
    5: [2, 6, 8],
    6: [5, 7],
    7: [6, 8],
    8: [5, 7],
}


compute_ap(data)