


import sys
from collections import defaultdict


class 					lowerCAmelCase_ :




      def __init__(	self						:   Optional[int]						)      ->Any:






         """simple docstring"""






         a__ :Optional[Any]						  =    []




      def  _snake_case					(	self						:   Optional[Any]   ,     __A						:   List[Any]						)      ->List[str]:






         """simple docstring"""






         return self.node_position[vertex]




      def  _snake_case					(	self						:   Optional[Any]   ,     __A						:   str   ,     __A						:   Any						)      ->Dict:






         """simple docstring"""






         a__ :Dict						  =    pos




      def  _snake_case					(	self						:   str   ,     __A						:   Union[str, Any]   ,     __A						:   Union[str, Any]   ,     __A						:   Optional[Any]   ,     __A						:   Optional[int]						)      ->List[Any]:






         """simple docstring"""






         if start > size // 2 - 1:
            return
         else:
            if 2 * start + 2 >= size:
               a__ :str						  =    2 * start + 1
            else:
               if heap[2 * start + 1] < heap[2 * start + 2]:
                  a__ :Optional[int]						  =    2 * start + 1
               else:
                  a__ :List[Any]						  =    2 * start + 2
            if heap[smallest_child] < heap[start]:
               a__ :Optional[Any]						  =    heap[smallest_child], positions[smallest_child]
               a__ :int						  =    (
                   heap[start],
                   positions[start],
               )
               a__ :List[Any]						  =    temp, tempa

               a__ :Any						  =    self.get_position(positions[smallest_child]						)
               self.set_position(
                   positions[smallest_child]   ,     self.get_position(positions[start]						)						)
               self.set_position(positions[start]   ,     __A						)

               self.top_to_bottom(__A   ,     __A   ,     __A   ,     __A						)




      def  _snake_case					(	self						:   List[str]   ,     __A						:   Any   ,     __A						:   List[str]   ,     __A						:   Any   ,     __A						:   str						)      ->Optional[Any]:






         """simple docstring"""






         a__ :Optional[Any]						  =    position[index]

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

            if val < heap[parent]:
               a__ :int						  =    heap[parent]
               a__ :Optional[Any]						  =    position[parent]
               self.set_position(position[parent]   ,     __A						)
            else:
               a__ :List[Any]						  =    val
               a__ :List[Any]						  =    temp
               self.set_position(__A   ,     __A						)
               break
            a__ :Union[str, Any]						  =    parent
         else:
            a__ :int						  =    val
            a__ :Dict						  =    temp
            self.set_position(__A   ,     0						)




      def  _snake_case					(	self						:   Tuple   ,     __A						:   int   ,     __A						:   int						)      ->Union[str, Any]:






         """simple docstring"""






         a__ :Tuple						  =    len(__A						) // 2 - 1
         for i in range(__A   ,     -1   ,     -1						):
            self.top_to_bottom(__A   ,     __A   ,     len(__A						)   ,     __A						)






      def  _snake_case					(	self						:   List[Any]   ,     __A						:   List[Any]   ,     __A						:   int						)      ->Optional[Any]:






         """simple docstring"""






         a__ :Any						  =    positions[0]
         a__ :str						  =    sys.maxsize
         self.top_to_bottom(__A   ,     0   ,     len(__A						)   ,     __A						)
         return temp






def 				lowerCamelCase__	(      a	:   Any				)    ->	Union[str, Any]:





   """simple docstring"""
   a__ :Tuple						  =    Heap()

   a__ :List[Any]						  =    [0] * len(a				)
   a__ :str						  =    [-1] * len(a				)  # Neighboring Tree Vertex of selected vertex
   # Minimum Distance of explored vertex with neighboring vertex of partial tree
   # formed in graph
   a__ :Any						  =    []  # Heap of Distance of vertices from their neighboring vertex
   a__ :int						  =    []

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

   a__ :Tuple						  =    []
   a__ :Any						  =    1
   a__ :int						  =    sys.maxsize
   for neighbor, distance in adjacency_list[0]:
      a__ :int						  =    0
      a__ :List[str]						  =    distance
   heap.heapify(a	,  a				)

   for _ in range(1	,  len(a				)				):
      a__ :Dict						  =    heap.delete_minimum(a	,  a				)
      if visited[vertex] == 0:
         tree_edges.append((nbr_tv[vertex], vertex)				)
         a__ :Optional[int]						  =    1
         for neighbor, distance in adjacency_list[vertex]:
            if (
                visited[neighbor] == 0
                and distance < distance_tv[heap.get_position(a				)]
            ):
               a__ :List[str]						  =    distance
               heap.bottom_to_top(
                   a	,  heap.get_position(a				)	,  a	,  a				)
               a__ :str						  =    vertex
   return tree_edges


if __name__ == "__main__":  # pragma: no cover
  # < --------- Prims Algorithm --------- >
  snake_case__			 =						int(input('''Enter number of edges: ''').strip())
  snake_case__			 =						defaultdict(list)
  for _ in range(edges_number):
    snake_case__			 =						[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


snake_case__			 =						logging.get_logger(__name__)

snake_case__			 =						{
    '''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 					lowerCAmelCase_ (       _a):
						lowerCamelCase_         =     'pegasus'
						lowerCamelCase_         =     ['past_key_values']
						lowerCamelCase_         =     {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}




						def __init__(	self						:   Any   ,     __A						:   Dict=50265   ,     __A						:   List[Any]=1024   ,     __A						:   int=12   ,     __A						:   Optional[Any]=4096   ,     __A						:   Optional[int]=16   ,     __A						:   Dict=12   ,     __A						:   List[Any]=4096   ,     __A						:   List[str]=16   ,     __A						:   Optional[int]=0.0   ,     __A						:   List[Any]=0.0   ,     __A						:   List[str]=True   ,     __A						:   Optional[int]=True   ,     __A						:   str="gelu"   ,     __A						:   Tuple=1024   ,     __A						:   Any=0.1   ,     __A						:   List[Any]=0.0   ,     __A						:   List[str]=0.0   ,     __A						:   Tuple=0.02   ,     __A						:   Union[str, Any]=0   ,     __A						:   Union[str, Any]=False   ,     __A						:   Optional[Any]=0   ,     __A						:   Tuple=1   ,     __A						:   str=1   ,     **__A						:   Any   ,     )      ->Union[str, Any]:






									"""simple docstring"""






									a__ :Any						  =    vocab_size
									a__ :List[str]						  =    max_position_embeddings
									a__ :int						  =    d_model
									a__ :Union[str, Any]						  =    encoder_ffn_dim
									a__ :List[Any]						  =    encoder_layers
									a__ :Union[str, Any]						  =    encoder_attention_heads
									a__ :Tuple						  =    decoder_ffn_dim
									a__ :List[Any]						  =    decoder_layers
									a__ :Tuple						  =    decoder_attention_heads
									a__ :Optional[int]						  =    dropout
									a__ :str						  =    attention_dropout
									a__ :Optional[int]						  =    activation_dropout
									a__ :str						  =    activation_function
									a__ :Dict						  =    init_std
									a__ :Any						  =    encoder_layerdrop
									a__ :int						  =    decoder_layerdrop
									a__ :Union[str, Any]						  =    use_cache
									a__ :List[Any]						  =    encoder_layers
									a__ :Dict						  =    scale_embedding  # scale factor will be sqrt(d_model) if True
									super().__init__(
									    pad_token_id=__A   ,     eos_token_id=__A   ,     is_encoder_decoder=__A   ,     decoder_start_token_id=__A   ,     forced_eos_token_id=__A   ,     **__A   ,     )




						@property
						def  _snake_case					(	self						:   Optional[Any]						)      ->int:






									"""simple docstring"""






									return self.encoder_attention_heads






						@property
						def  _snake_case					(	self						:   Union[str, Any]						)      ->int:






									"""simple docstring"""






									return self.d_model


