from __future__ import annotations





class   lowerCAmelCase    :



     def __init__(       self					,   lowerCAmelCase__							):
            _A=						vertices
            _A=						[[0] * vertices for _ in range(lowerCAmelCase__							)]



     def       a__	(       self					,   lowerCAmelCase__							):
            print('Vertex \t Distance from Source'							)
            for vertex in range(self.vertices							):
                   print(lowerCAmelCase__					,   '\t\t'					,   distances_from_source[vertex]							)



     def       a__	(       self					,   lowerCAmelCase__					,   lowerCAmelCase__							):
            _A=						1E7
            _A=						0

            # Search not nearest vertex not in the shortest path tree
            for vertex in range(self.vertices							):
                   if distances_from_source[vertex] < minimum and visited[vertex] is False:
                          _A=						distances_from_source[vertex]
                          _A=						vertex
            return min_index





     def       a__	(       self					,   lowerCAmelCase__							):
            _A=						[int(1E7							)] * self.vertices  # distances from the source
            _A=						0
            _A=						[False] * self.vertices

            for _ in range(self.vertices							):
                   _A=						self.minimum_distance(lowerCAmelCase__					,   lowerCAmelCase__							)
                   _A=						True

                   # Update dist value of the adjacent vertices
                   # of the picked vertex only if the current
                   # distance is greater than new distance and
                   # the vertex in not in the shortest path tree
                   for v in range(self.vertices							):
                          if (
                              self.graph[u][v] > 0
                              and visited[v] is False
                              and distances[v] > distances[u] + self.graph[u][v]
                          ):
                                 _A=						distances[u] + self.graph[u][v]

            self.print_solution(lowerCAmelCase__							)


if __name__ == "__main__":
      UpperCAmelCase_    		=				Graph(9)
      UpperCAmelCase_    		=				[
          [0, 4, 0, 0, 0, 0, 0, 8, 0],
          [4, 0, 8, 0, 0, 0, 0, 11, 0],
          [0, 8, 0, 7, 0, 4, 0, 0, 2],
          [0, 0, 7, 0, 9, 14, 0, 0, 0],
          [0, 0, 0, 9, 0, 10, 0, 0, 0],
          [0, 0, 4, 14, 10, 0, 2, 0, 0],
          [0, 0, 0, 0, 0, 2, 0, 1, 6],
          [8, 11, 0, 0, 0, 0, 1, 0, 7],
          [0, 0, 2, 0, 0, 0, 6, 7, 0],
      ]
      graph.dijkstra(0)
from ..utils import DummyObject, requires_backends





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Any		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  int		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  int		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  int		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Dict		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  List[str]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  str		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Union[str, Any]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)





class   lowerCAmelCase    (       metaclass=_a      ):
     _SCREAMING_SNAKE_CASE  :  Optional[int]		=["""vision"""]



     def __init__(       self					,   *lowerCAmelCase__					,   **lowerCAmelCase__							):
            requires_backends(self					,   ['vision']							)