



"""simple docstring"""






import sys
from collections import defaultdict

class 						__lowerCAmelCase				:


					'''simple docstring'''


					def __init__(   self ):




										"""simple docstring"""





										snake_case_    :Any										=    []







					def 		_a			(   self     ,							a ):




										"""simple docstring"""





										return self.node_position[vertex]







					def 		_a			(   self     ,							a     ,							a ):




										"""simple docstring"""





										snake_case_    :str										=    pos







					def 		_a			(   self     ,							a     ,							a     ,							a     ,							a ):




										"""simple docstring"""





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

																				snake_case_    :Optional[int]										=    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 		_a			(   self     ,							a     ,							a     ,							a     ,							a ):




										"""simple docstring"""





										snake_case_    :Tuple										=    position[index]

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

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







					def 		_a			(   self     ,							a     ,							a ):




										"""simple docstring"""





										snake_case_    :List[str]										=    len(_UpperCamelCase ) // 2 - 1
										for i in range(_UpperCamelCase     ,							-1     ,							-1 ):
															self.top_to_bottom(_UpperCamelCase     ,							_UpperCamelCase     ,							len(_UpperCamelCase )     ,							_UpperCamelCase )







					def 		_a			(   self     ,							a     ,							a ):




										"""simple docstring"""





										snake_case_    :Optional[Any]										=    positions[0]
										snake_case_    :Union[str, Any]										=    sys.maxsize
										self.top_to_bottom(_UpperCamelCase     ,							0     ,							len(_UpperCamelCase )     ,							_UpperCamelCase )
										return temp



def   A   (      _A				):




					"""simple docstring"""
					snake_case_    :List[Any]										=    Heap()

					snake_case_    :List[Any]										=    [0] * len(SCREAMING_SNAKE_CASE_				)
					snake_case_    :Any										=    [-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
					snake_case_    :int										=    []  # Heap of Distance of vertices from their neighboring vertex
					snake_case_    :Optional[int]										=    []

					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_				)

					snake_case_    :List[str]										=    []
					snake_case_    :str										=    1
					snake_case_    :Union[str, Any]										=    sys.maxsize
					for neighbor, distance in adjacency_list[0]:
										snake_case_    :Tuple										=    0
										snake_case_    :Tuple										=    distance
					heap.heapify(SCREAMING_SNAKE_CASE_,  SCREAMING_SNAKE_CASE_				)

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


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


UpperCAmelCase_           =	logging.get_logger(__name__)

UpperCAmelCase_           =	{
    "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json",
    # See all BioGPT models at https://huggingface.co/models?filter=biogpt
}




class 			__UpperCamelCase    (							A__    ):
     __A	:  Any							  =   """biogpt"""





     def __init__(     self				,							_UpperCamelCase=42384				,							_UpperCamelCase=1024				,							_UpperCamelCase=24				,							_UpperCamelCase=16				,							_UpperCamelCase=4096				,							_UpperCamelCase="gelu"				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.1				,							_UpperCamelCase=1024				,							_UpperCamelCase=0.02				,							_UpperCamelCase=1e-12				,							_UpperCamelCase=True				,							_UpperCamelCase=True				,							_UpperCamelCase=0.0				,							_UpperCamelCase=0.0				,							_UpperCamelCase=1				,							_UpperCamelCase=0				,							_UpperCamelCase=2				,							**_UpperCamelCase				,							):
        _UpperCAmelCase           =   vocab_size
        _UpperCAmelCase           =   max_position_embeddings
        _UpperCAmelCase           =   hidden_size
        _UpperCAmelCase           =   num_hidden_layers
        _UpperCAmelCase           =   num_attention_heads
        _UpperCAmelCase           =   intermediate_size
        _UpperCAmelCase           =   hidden_act
        _UpperCAmelCase           =   hidden_dropout_prob
        _UpperCAmelCase           =   attention_probs_dropout_prob
        _UpperCAmelCase           =   initializer_range
        _UpperCAmelCase           =   layer_norm_eps
        _UpperCAmelCase           =   scale_embedding
        _UpperCAmelCase           =   use_cache
        _UpperCAmelCase           =   layerdrop
        _UpperCAmelCase           =   activation_dropout
        super().__init__(pad_token_id=_UpperCamelCase				,							bos_token_id=_UpperCamelCase				,							eos_token_id=_UpperCamelCase				,							**_UpperCamelCase					)