




import sys
from collections import defaultdict







class     __lowerCAmelCase :

			"""simple docstring"""







			def __init__(      self							)    ->      Tuple:



							'''simple docstring'''
							__lowerCamelCase		       =    []


			def       lowercase_    (      self			,						lowerCamelCase__							)    ->      Dict:



							'''simple docstring'''
							return self.node_position[vertex]


			def       lowercase_    (      self			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      Tuple:



							'''simple docstring'''
							__lowerCamelCase		       =    pos


			def       lowercase_    (      self			,						lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      List[str]:



							'''simple docstring'''
							if start > size // 2 - 1:
											return
							else:
											if 2 * start + 2 >= size:
															__lowerCamelCase		       =    2 * start + 1
											else:
															if heap[2 * start + 1] < heap[2 * start + 2]:
																			__lowerCamelCase		       =    2 * start + 1
															else:
																			__lowerCamelCase		       =    2 * start + 2
											if heap[smallest_child] < heap[start]:
															__lowerCamelCase       ,						__lowerCamelCase		       =    heap[smallest_child], positions[smallest_child]
															__lowerCamelCase       ,						__lowerCamelCase		       =    (
															    heap[start],
															    positions[start],
															)
															__lowerCamelCase       ,						__lowerCamelCase		       =    temp, tempa

															__lowerCamelCase		       =    self.get_position(positions[smallest_child]							)
															self.set_position(
															    positions[smallest_child]			,						self.get_position(positions[start]							)							)
															self.set_position(positions[start]			,						lowerCamelCase__							)

															self.top_to_bottom(lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__			,						lowerCamelCase__							)


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



							'''simple docstring'''
							__lowerCamelCase		       =    position[index]

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

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


			def       lowercase_    (      self			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      List[Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    len(lowerCamelCase__							) // 2 - 1
							for i in range(lowerCamelCase__			,						-1			,						-1							):
											self.top_to_bottom(lowerCamelCase__			,						lowerCamelCase__			,						len(lowerCamelCase__							)			,						lowerCamelCase__							)






			def       lowercase_    (      self			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      Any:



							'''simple docstring'''
							__lowerCamelCase		       =    positions[0]
							__lowerCamelCase		       =    sys.maxsize
							self.top_to_bottom(lowerCamelCase__			,						0			,						len(lowerCamelCase__							)			,						lowerCamelCase__							)
							return temp







def 			lowerCamelCase_		(       UpperCamelCase__				:      str      )     ->       List[str]:





				"""simple docstring"""


				__lowerCamelCase		       =    Heap()

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

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

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

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


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


a_    					=       logging.get_logger(__name__)

a_    					=       {
    # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}





class 		_lowercase						(					snake_case_       ):
 lowercase				     =   'megatron-bert'

 def __init__( self	:							List[str]   ,      snake_case	:							Tuple=2_9_0_5_6   ,      snake_case	:							Dict=1_0_2_4   ,      snake_case	:							Dict=2_4   ,      snake_case	:							Union[str, Any]=1_6   ,      snake_case	:							Optional[int]=4_0_9_6   ,      snake_case	:							Optional[int]="gelu"   ,      snake_case	:							Any=0.1   ,      snake_case	:							Tuple=0.1   ,      snake_case	:							Optional[int]=5_1_2   ,      snake_case	:							List[Any]=2   ,      snake_case	:							Tuple=0.02   ,      snake_case	:							Optional[Any]=1e-12   ,      snake_case	:							str=0   ,      snake_case	:							Optional[int]="absolute"   ,      snake_case	:							Union[str, Any]=True   ,      **snake_case	:							Any   ,      )   ->						List[Any]:

  """simple docstring"""





  super().__init__(pad_token_id=snake_case   ,      **snake_case			)

  UpperCamelCase_					:						Optional[Any] =					vocab_size
  UpperCamelCase_					:						Any =					hidden_size
  UpperCamelCase_					:						Union[str, Any] =					num_hidden_layers
  UpperCamelCase_					:						List[Any] =					num_attention_heads
  UpperCamelCase_					:						str =					hidden_act
  UpperCamelCase_					:						List[str] =					intermediate_size
  UpperCamelCase_					:						List[Any] =					hidden_dropout_prob
  UpperCamelCase_					:						Any =					attention_probs_dropout_prob
  UpperCamelCase_					:						Tuple =					max_position_embeddings
  UpperCamelCase_					:						Dict =					type_vocab_size
  UpperCamelCase_					:						Optional[int] =					initializer_range
  UpperCamelCase_					:						Optional[Any] =					layer_norm_eps
  UpperCamelCase_					:						Dict =					position_embedding_type
  UpperCamelCase_					:						List[str] =					use_cache



