



def 						_lowerCAmelCase    (					__lowerCamelCase :  str		,						__lowerCamelCase :  Optional[int]  ):



 """simple docstring"""





 print("\nVertex Distance"  )
 for i in range(__lowerCamelCase  ):
  if dist[i] != float("inf"  ):
   print(__lowerCamelCase		,						"\t"		,						int(dist[i]  )		,						end="\t"  )
  else:
   print(__lowerCamelCase		,						"\t"		,						"INF"		,						end="\t"  )
  print()






def 						_lowerCAmelCase    (					__lowerCamelCase :  str		,						__lowerCamelCase :  Optional[Any]		,						__lowerCamelCase :  List[Any]  ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE							:     Optional[Any]							=						float("inf"  )
 __SCREAMING_SNAKE_CASE							:     str							=						-1
 for i in range(__lowerCamelCase  ):
  if (not vset[i]) and mdist[i] < min_val:
   __SCREAMING_SNAKE_CASE							:     Tuple							=						i
   __SCREAMING_SNAKE_CASE							:     Optional[int]							=						mdist[i]
 return min_ind






def 						_lowerCAmelCase    (					__lowerCamelCase :  List[str]		,						__lowerCamelCase :  List[Any]		,						__lowerCamelCase :  Optional[Any]  ):



 """simple docstring"""





 __SCREAMING_SNAKE_CASE							:     str							=						[float("inf"  ) for _ in range(__lowerCamelCase  )]
 __SCREAMING_SNAKE_CASE							:     str							=						[False for _ in range(__lowerCamelCase  )]
 __SCREAMING_SNAKE_CASE							:     int							=						0.0

 for _ in range(v - 1  ):
  __SCREAMING_SNAKE_CASE							:     Tuple							=						min_dist(__lowerCamelCase		,						__lowerCamelCase		,						__lowerCamelCase  )
  __SCREAMING_SNAKE_CASE							:     Union[str, Any]							=						True

  for i in range(__lowerCamelCase  ):
   if (
       (not vset[i])
       and graph[u][i] != float("inf"  )
       and mdist[u] + graph[u][i] < mdist[i]
   ):
    __SCREAMING_SNAKE_CASE							:     Optional[int]							=						mdist[u] + graph[u][i]

 print_dist(__lowerCamelCase		,						__lowerCamelCase  )


if __name__ == "__main__":
      _lowerCamelCase         =	int(input("""Enter number of vertices: """).strip())
      _lowerCamelCase         =	int(input("""Enter number of edges: """).strip())

      _lowerCamelCase         =	[[float("""inf""") for i in range(V)] for j in range(V)]

      for i in range(V):
            _lowerCamelCase         =	0.0

      for i in range(E):
            print("""\nEdge """, i + 1)
            _lowerCamelCase         =	int(input("""Enter source:""").strip())
            _lowerCamelCase         =	int(input("""Enter destination:""").strip())
            _lowerCamelCase         =	float(input("""Enter weight:""").strip())
            _lowerCamelCase         =	weight

      _lowerCamelCase         =	int(input("""\nEnter shortest path source:""").strip())
      dijkstra(graph, V, gsrc)









'''simple docstring'''


from __future__ import annotations

from collections.abc import Iterable, Iterator
from typing import Any, Generic, TypeVar

lowerCAmelCase__      				=			TypeVar("T", bound=bool)



class        lowercase    (	Generic[T]			):


							def __init__(      self     ,      _snake_case)				->					None:
								UpperCAmelCase_		:   T													=       value
								UpperCAmelCase_		:   SkewNode[T] | None													=       None
								UpperCAmelCase_		:   SkewNode[T] | None													=       None


							@property
							def     _snake_case				(      self)				->					T:
								return self._value





							@staticmethod
							def     _snake_case				(      _snake_case     ,      _snake_case)				->					SkewNode[T] | None:
								if not roota:
									return roota

								if not roota:
									return roota

								if roota.value > roota.value:
									UpperCAmelCase_						,     UpperCAmelCase_		:   Union[str, Any]													=       roota, roota

								UpperCAmelCase_		:   Dict													=       roota
								UpperCAmelCase_		:   Dict													=       roota.right
								UpperCAmelCase_		:   Optional[int]													=       roota.left
								UpperCAmelCase_		:   Dict													=       SkewNode.merge(_snake_case     ,      _snake_case)

								return result



class        lowercase    (	Generic[T]			):


							def __init__(      self     ,      _snake_case = ())				->					None:
								UpperCAmelCase_		:   SkewNode[T] | None													=       None
								if data:
									for item in data:
										self.insert(_snake_case)


							def __bool__(      self)				->					bool:
								return self._root is not None


							def __iter__(      self)				->					Iterator[T]:
								UpperCAmelCase_		:   list[Any]													=       []
								while self:
									result.append(self.pop())

								# Pushing items back to the heap not to clear it.
								for item in result:
									self.insert(_snake_case)

								return iter(_snake_case)


							def     _snake_case				(      self     ,      _snake_case)				->					None:
								UpperCAmelCase_		:   Any													=       SkewNode.merge(self._root     ,      SkewNode(_snake_case))


							def     _snake_case				(      self)				->					T | None:
								UpperCAmelCase_		:   Union[str, Any]													=       self.top()
								UpperCAmelCase_		:   Tuple													=       (
								    SkewNode.merge(self._root.left     ,      self._root.right) if self._root else None
								)

								return result


							def     _snake_case				(      self)				->					T:
								if not self._root:
									raise IndexError('Can\'t get top element for the empty heap.')
								return self._root.value





							def     _snake_case				(      self)				->					None:
								UpperCAmelCase_		:   Union[str, Any]													=       None


if __name__ == "__main__":
						import doctest

						doctest.testmod()






