
"""simple docstring"""







import heapq as hq
import math
from collections.abc import Iterator



class 		UpperCAmelCase_						:
 """simple docstring"""




 def __init__(			self							:			Union[str, Any]  , a_							:			str			)->       int:



      """simple docstring"""

      UpperCAmelCase_    :     Tuple            =	str(id_			)
      UpperCAmelCase_    :     List[Any]            =	None
      UpperCAmelCase_    :     int            =	None
      UpperCAmelCase_    :     List[Any]            =	[]
      UpperCAmelCase_    :     int            =	{}  # {vertex:distance}




 def __lt__(			self							:			Any  , a_							:			List[Any]			)->       Optional[Any]:



      """simple docstring"""

      return self.key < other.key




 def __repr__(			self							:			Any			)->       Any:



      """simple docstring"""

      return self.id




 def 	a   (			self							:			Union[str, Any]  , a_							:			Optional[Any]			)->       Dict:



      """simple docstring"""

      self.neighbors.append(a_			)






 def 	a   (			self							:			Optional[int]  , a_							:			List[Any]  , a_							:			List[str]			)->       Dict:



      """simple docstring"""

      UpperCAmelCase_    :     str            =	weight




def       A_      (       lowercase    ,			lowercase    ,			lowercase    ,			lowercase   )  ->				Any:


     """simple docstring"""







     graph[a - 1].add_neighbor(graph[b - 1]   )
     graph[b - 1].add_neighbor(graph[a - 1]   )
     # add the edges:
     graph[a - 1].add_edge(graph[b - 1]    ,			lowercase   )
     graph[b - 1].add_edge(graph[a - 1]    ,			lowercase   )




def       A_      (       lowercase    ,			lowercase   )  ->				list:


     """simple docstring"""







     UpperCAmelCase_    :     str            =	[]
     for u in graph:
          UpperCAmelCase_    :     List[str]            =	math.inf
          UpperCAmelCase_    :     Tuple            =	None
     UpperCAmelCase_    :     str            =	0
     UpperCAmelCase_    :     List[Any]            =	graph[:]
     while q:
          UpperCAmelCase_    :     List[str]            =	min(lowercase   )
          q.remove(lowercase   )
          for v in u.neighbors:
               if (v in q) and (u.edges[v.id] < v.key):
                    UpperCAmelCase_    :     Dict            =	u
                    UpperCAmelCase_    :     Optional[Any]            =	u.edges[v.id]
     for i in range(1    ,			len(lowercase   )   ):
          a.append((int(graph[i].id   ) + 1, int(graph[i].pi.id   ) + 1)   )
     return a




def       A_      (       lowercase    ,			lowercase   )  ->				Iterator[tuple]:


     """simple docstring"""







     for u in graph:
          UpperCAmelCase_    :     int            =	math.inf
          UpperCAmelCase_    :     str            =	None
     UpperCAmelCase_    :     Optional[int]            =	0

     UpperCAmelCase_    :     List[str]            =	list(lowercase   )
     hq.heapify(lowercase   )

     while h:
          UpperCAmelCase_    :     Dict            =	hq.heappop(lowercase   )
          for v in u.neighbors:
               if (v in h) and (u.edges[v.id] < v.key):
                    UpperCAmelCase_    :     str            =	u
                    UpperCAmelCase_    :     int            =	u.edges[v.id]
                    hq.heapify(lowercase   )

     for i in range(1    ,			len(lowercase   )   ):
          yield (int(graph[i].id   ) + 1, int(graph[i].pi.id   ) + 1)




def       A_      (       )  ->				None:


     """simple docstring"""









if __name__ == "__main__":
       import doctest

       doctest.testmod()



"""simple docstring"""







from string import ascii_lowercase, ascii_uppercase




def       A_      (       lowercase   )  ->				str:


     """simple docstring"""







     if not sentence:
          return ""
     UpperCAmelCase_    :     Any            =	dict(zip(lowercase    ,			lowercase   )   )
     return lower_to_upper.get(sentence[0]    ,			sentence[0]   ) + sentence[1:]


if __name__ == "__main__":
       from doctest import testmod

       testmod()

