





import sys
from collections import defaultdict




class 			__UpperCamelCase    :





     def __init__(     self					):
        _UpperCAmelCase           =   []





     def 		UpperCamelCase(     self				,							_UpperCamelCase					):
        return self.node_position[vertex]





     def 		UpperCamelCase(     self				,							_UpperCamelCase				,							_UpperCamelCase					):
        _UpperCAmelCase           =   pos





     def 		UpperCamelCase(     self				,							_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase					):
        if start > size // 2 - 1:
           return
        else:
           if 2 * start + 2 >= size:
              _UpperCAmelCase           =   2 * start + 1
           else:
              if heap[2 * start + 1] < heap[2 * start + 2]:
                 _UpperCAmelCase           =   2 * start + 1
              else:
                 _UpperCAmelCase           =   2 * start + 2
           if heap[smallest_child] < heap[start]:
              _UpperCAmelCase       ,      _UpperCAmelCase           =   heap[smallest_child], positions[smallest_child]
              _UpperCAmelCase       ,      _UpperCAmelCase           =   (
                  heap[start],
                  positions[start],
              )
              _UpperCAmelCase       ,      _UpperCAmelCase           =   temp, tempa

              _UpperCAmelCase           =   self.get_position(positions[smallest_child]					)
              self.set_position(
                  positions[smallest_child]				,							self.get_position(positions[start]					)					)
              self.set_position(positions[start]				,							_UpperCamelCase					)

              self.top_to_bottom(_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase					)





     def 		UpperCamelCase(     self				,							_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase				,							_UpperCamelCase					):
        _UpperCAmelCase           =   position[index]

        while index != 0:
           _UpperCAmelCase           =   int((index - 2) / 2					) if index % 2 == 0 else int((index - 1) / 2					)

           if val < heap[parent]:
              _UpperCAmelCase           =   heap[parent]
              _UpperCAmelCase           =   position[parent]
              self.set_position(position[parent]				,							_UpperCamelCase					)
           else:
              _UpperCAmelCase           =   val
              _UpperCAmelCase           =   temp
              self.set_position(_UpperCamelCase				,							_UpperCamelCase					)
              break
           _UpperCAmelCase           =   parent
        else:
           _UpperCAmelCase           =   val
           _UpperCAmelCase           =   temp
           self.set_position(_UpperCamelCase				,							0					)





     def 		UpperCamelCase(     self				,							_UpperCamelCase				,							_UpperCamelCase					):
        _UpperCAmelCase           =   len(_UpperCamelCase					) // 2 - 1
        for i in range(_UpperCamelCase				,							-1				,							-1					):
           self.top_to_bottom(_UpperCamelCase				,							_UpperCamelCase				,							len(_UpperCamelCase					)				,							_UpperCamelCase					)





     def 		UpperCamelCase(     self				,							_UpperCamelCase				,							_UpperCamelCase					):
        _UpperCAmelCase           =   positions[0]
        _UpperCAmelCase           =   sys.maxsize
        self.top_to_bottom(_UpperCamelCase				,							0				,							len(_UpperCamelCase					)				,							_UpperCamelCase					)
        return temp




def      A__       (    SCREAMING_SNAKE_CASE_   :      Dict						)  ->  Dict:






   """simple docstring"""







   _UpperCAmelCase           =   Heap()

   _UpperCAmelCase           =   [0] * len(SCREAMING_SNAKE_CASE_						)
   _UpperCAmelCase           =   [-1] * len(SCREAMING_SNAKE_CASE_						)  # Neighboring Tree Vertex of selected vertex
   # Minimum Distance of explored vertex with neighboring vertex of partial tree
   # formed in graph
   _UpperCAmelCase           =   []  # Heap of Distance of vertices from their neighboring vertex
   _UpperCAmelCase           =   []

   for vertex in range(len(SCREAMING_SNAKE_CASE_						)						):
      distance_tv.append(sys.maxsize						)
      positions.append(SCREAMING_SNAKE_CASE_						)
      heap.node_position.append(SCREAMING_SNAKE_CASE_						)

   _UpperCAmelCase           =   []
   _UpperCAmelCase           =   1
   _UpperCAmelCase           =   sys.maxsize
   for neighbor, distance in adjacency_list[0]:
      _UpperCAmelCase           =   0
      _UpperCAmelCase           =   distance
   heap.heapify(SCREAMING_SNAKE_CASE_				,	SCREAMING_SNAKE_CASE_						)

   for _ in range(1				,	len(SCREAMING_SNAKE_CASE_						)						):
      _UpperCAmelCase           =   heap.delete_minimum(SCREAMING_SNAKE_CASE_				,	SCREAMING_SNAKE_CASE_						)
      if visited[vertex] == 0:
         tree_edges.append((nbr_tv[vertex], vertex)						)
         _UpperCAmelCase           =   1
         for neighbor, distance in adjacency_list[vertex]:
            if (
                visited[neighbor] == 0
                and distance < distance_tv[heap.get_position(SCREAMING_SNAKE_CASE_						)]
            ):
               _UpperCAmelCase           =   distance
               heap.bottom_to_top(
                   SCREAMING_SNAKE_CASE_				,	heap.get_position(SCREAMING_SNAKE_CASE_						)				,	SCREAMING_SNAKE_CASE_				,	SCREAMING_SNAKE_CASE_						)
               _UpperCAmelCase           =   vertex
   return tree_edges


if __name__ == "__main__":  # pragma: no cover
   # < --------- Prims Algorithm --------- >
   UpperCAmelCase_           =	int(input("Enter number of edges: ").strip())
   UpperCAmelCase_           =	defaultdict(list)
   for _ in range(edges_number):
      UpperCAmelCase_           =	[int(x) for x in input().strip().split()]
      adjacency_list[edge[0]].append([edge[1], edge[2]])
      adjacency_list[edge[1]].append([edge[0], edge[2]])
   print(prisms_algorithm(adjacency_list))







from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase      :       Optional[int]    =						logging.get_logger(__name__)

lowerCamelCase      :       Optional[Any]    =						{
    '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''',
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}



class 				_UpperCamelCase      (a_      ):
      snake_case_	=				"""pegasus"""
      snake_case_	=				["""past_key_values"""]
      snake_case_	=				{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}


      def __init__(						self       ,    __UpperCamelCase=5_0_2_6_5       ,    __UpperCamelCase=1_0_2_4       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=4_0_9_6       ,    __UpperCamelCase=1_6       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=4_0_9_6       ,    __UpperCamelCase=1_6       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=True       ,    __UpperCamelCase=True       ,    __UpperCamelCase="gelu"       ,    __UpperCamelCase=1_0_2_4       ,    __UpperCamelCase=0.1       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0_2       ,    __UpperCamelCase=0       ,    __UpperCamelCase=False       ,    __UpperCamelCase=0       ,    __UpperCamelCase=1       ,    __UpperCamelCase=1       ,    **__UpperCamelCase       ,    )->						Tuple:
           __lowerCAmelCase             =       vocab_size
           __lowerCAmelCase             =       max_position_embeddings
           __lowerCAmelCase             =       d_model
           __lowerCAmelCase             =       encoder_ffn_dim
           __lowerCAmelCase             =       encoder_layers
           __lowerCAmelCase             =       encoder_attention_heads
           __lowerCAmelCase             =       decoder_ffn_dim
           __lowerCAmelCase             =       decoder_layers
           __lowerCAmelCase             =       decoder_attention_heads
           __lowerCAmelCase             =       dropout
           __lowerCAmelCase             =       attention_dropout
           __lowerCAmelCase             =       activation_dropout
           __lowerCAmelCase             =       activation_function
           __lowerCAmelCase             =       init_std
           __lowerCAmelCase             =       encoder_layerdrop
           __lowerCAmelCase             =       decoder_layerdrop
           __lowerCAmelCase             =       use_cache
           __lowerCAmelCase             =       encoder_layers
           __lowerCAmelCase             =       scale_embedding  # scale factor will be sqrt(d_model) if True
           super().__init__(
               pad_token_id=__UpperCamelCase       ,    eos_token_id=__UpperCamelCase       ,    is_encoder_decoder=__UpperCamelCase       ,    decoder_start_token_id=__UpperCamelCase       ,    forced_eos_token_id=__UpperCamelCase       ,    **__UpperCamelCase       ,    )


      @property
      def 			__UpperCAmelCase		(						self						)->						int:
           return self.encoder_attention_heads


      @property
      def 			__UpperCAmelCase		(						self						)->						int:
           return self.d_model






