
"""simple docstring"""





_a		       =							{
    0: '0',
    1: '1',
    2: '2',
    3: '3',
    4: '4',
    5: '5',
    6: '6',
    7: '7',
    8: '8',
    9: '9',
    10: 'a',
    11: 'b',
    12: 'c',
    13: 'd',
    14: 'e',
    15: 'f',
}







def 	__a     (		__lowerCamelCase  ):
   assert type(__lowerCamelCase  ) in (int, float) and decimal == int(__lowerCamelCase  )
   UpperCAmelCase_					:					Any			     =    int(__lowerCamelCase  )
   UpperCAmelCase_					:					List[Any]			     =    ""
   UpperCAmelCase_					:					Union[str, Any]			     =    False
   if decimal < 0:
      UpperCAmelCase_					:					Optional[int]			     =    True
      decimal *= -1
   while decimal > 0:
      UpperCAmelCase_     ,   UpperCAmelCase_					:					Tuple			     =    divmod(__lowerCamelCase,		16  )
      UpperCAmelCase_					:					Optional[int]			     =    values[remainder] + hexadecimal
   UpperCAmelCase_					:					List[Any]			     =    "0x" + hexadecimal
   if negative:
      UpperCAmelCase_					:					Any			     =    "-" + hexadecimal
   return hexadecimal


if __name__ == "__main__":
    import doctest

    doctest.testmod()






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







class       lowerCamelCase__   :





     def __init__(self		,     UpperCAmelCase       )     ->   Any:
      _lowercase							      =str(id_       )
      _lowercase							      =None
      _lowercase							      =None
      _lowercase							      =[]
      _lowercase							      ={}  # {vertex:distance}





     def __lt__(self		,     UpperCAmelCase       )     ->   List[str]:
      return self.key < other.key





     def __repr__(self       )     ->   str:
      return self.id





     def      __A					(self		,     UpperCAmelCase       )     ->   Dict:
      self.neighbors.append(UpperCAmelCase       )





     def      __A					(self		,     UpperCAmelCase		,     UpperCAmelCase       )     ->   Optional[Any]:
      _lowercase							      =weight



def 				UpperCAmelCase_					(							__snake_case     ,						__snake_case     ,						__snake_case     ,						__snake_case						)     ->			List[str]:







 """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]     ,						__snake_case						)
 graph[b - 1].add_edge(graph[a - 1]     ,						__snake_case						)
def 				UpperCAmelCase_					(							__snake_case     ,						__snake_case						)     ->			list:







 """simple docstring"""


 _lowercase							      =[]
 for u in graph:
  _lowercase							      =math.inf
  _lowercase							      =None
 _lowercase							      =0
 _lowercase							      =graph[:]
 while q:
  _lowercase							      =min(__snake_case						)
  q.remove(__snake_case						)
  for v in u.neighbors:
   if (v in q) and (u.edges[v.id] < v.key):
    _lowercase							      =u
    _lowercase							      =u.edges[v.id]
 for i in range(1     ,						len(__snake_case						)						):
  a.append((int(graph[i].id						) + 1, int(graph[i].pi.id						) + 1)						)
 return a
def 				UpperCAmelCase_					(							__snake_case     ,						__snake_case						)     ->			Iterator[tuple]:







 """simple docstring"""


 for u in graph:
  _lowercase							      =math.inf
  _lowercase							      =None
 _lowercase							      =0

 _lowercase							      =list(__snake_case						)
 hq.heapify(__snake_case						)

 while h:
  _lowercase							      =hq.heappop(__snake_case						)
  for v in u.neighbors:
   if (v in h) and (u.edges[v.id] < v.key):
    _lowercase							      =u
    _lowercase							      =u.edges[v.id]
    hq.heapify(__snake_case						)

 for i in range(1     ,						len(__snake_case						)						):
  yield (int(graph[i].id						) + 1, int(graph[i].pi.id						) + 1)
def 				UpperCAmelCase_					(							)     ->			None:







 """simple docstring"""




if __name__ == "__main__":
  import doctest

  doctest.testmod()

