


import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


snake_case__    =						logging.get_logger(__name__)

snake_case__    =						{
    """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""",
}


class 					lowerCAmelCase_ (       SCREAMING_SNAKE_CASE__):
						lowerCamelCase_         =     'deta'
						lowerCamelCase_         =     {
						    'hidden_size': 'd_model',
						    'num_attention_heads': 'encoder_attention_heads',
						}




						def __init__(	self						:   Union[str, Any]   ,     __A						:   str=None   ,     __A						:   Optional[Any]=900   ,     __A						:   List[Any]=2048   ,     __A						:   int=6   ,     __A						:   Tuple=2048   ,     __A						:   Union[str, Any]=8   ,     __A						:   Any=6   ,     __A						:   Dict=1024   ,     __A						:   List[Any]=8   ,     __A						:   Optional[Any]=0.0   ,     __A						:   Optional[int]=True   ,     __A						:   Dict="relu"   ,     __A						:   str=256   ,     __A						:   int=0.1   ,     __A						:   str=0.0   ,     __A						:   List[str]=0.0   ,     __A						:   Union[str, Any]=0.02   ,     __A						:   str=1.0   ,     __A						:   Optional[int]=True   ,     __A						:   str=False   ,     __A						:   Dict="sine"   ,     __A						:   Any=5   ,     __A						:   Optional[Any]=4   ,     __A						:   Optional[Any]=4   ,     __A						:   int=True   ,     __A						:   Tuple=300   ,     __A						:   int=True   ,     __A						:   str=True   ,     __A						:   str=1   ,     __A						:   str=5   ,     __A						:   Union[str, Any]=2   ,     __A						:   int=1   ,     __A						:   Optional[int]=1   ,     __A						:   Optional[int]=5   ,     __A						:   List[str]=2   ,     __A						:   Any=0.1   ,     __A						:   Optional[Any]=0.25   ,     **__A						:   Tuple   ,     )      ->Dict:






									"""simple docstring"""






									if backbone_config is None:
												logger.info("`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."						)
												a__ :Optional[int]						  =    CONFIG_MAPPING["resnet"](out_features=["stage2", "stage3", "stage4"]						)
									else:
												if isinstance(snake_case__   ,     snake_case__						):
															a__ :Union[str, Any]						  =    backbone_config.pop("model_type"						)
															a__ :Optional[int]						  =    CONFIG_MAPPING[backbone_model_type]
															a__ :Tuple						  =    config_class.from_dict(snake_case__						)

									a__ :List[str]						  =    backbone_config
									a__ :List[str]						  =    num_queries
									a__ :Optional[int]						  =    max_position_embeddings
									a__ :Union[str, Any]						  =    d_model
									a__ :Tuple						  =    encoder_ffn_dim
									a__ :List[Any]						  =    encoder_layers
									a__ :Dict						  =    encoder_attention_heads
									a__ :List[Any]						  =    decoder_ffn_dim
									a__ :Any						  =    decoder_layers
									a__ :Dict						  =    decoder_attention_heads
									a__ :Optional[int]						  =    dropout
									a__ :List[Any]						  =    attention_dropout
									a__ :List[Any]						  =    activation_dropout
									a__ :int						  =    activation_function
									a__ :Optional[Any]						  =    init_std
									a__ :str						  =    init_xavier_std
									a__ :Tuple						  =    encoder_layerdrop
									a__ :Union[str, Any]						  =    auxiliary_loss
									a__ :Any						  =    position_embedding_type
									# deformable attributes
									a__ :int						  =    num_feature_levels
									a__ :Union[str, Any]						  =    encoder_n_points
									a__ :str						  =    decoder_n_points
									a__ :str						  =    two_stage
									a__ :Optional[int]						  =    two_stage_num_proposals
									a__ :Any						  =    with_box_refine
									a__ :int						  =    assign_first_stage
									if two_stage is True and with_box_refine is False:
												raise ValueError("If two_stage is True, with_box_refine must be True."						)
									# Hungarian matcher
									a__ :int						  =    class_cost
									a__ :Any						  =    bbox_cost
									a__ :int						  =    giou_cost
									# Loss coefficients
									a__ :List[Any]						  =    mask_loss_coefficient
									a__ :List[str]						  =    dice_loss_coefficient
									a__ :Optional[int]						  =    bbox_loss_coefficient
									a__ :Any						  =    giou_loss_coefficient
									a__ :Any						  =    eos_coefficient
									a__ :List[str]						  =    focal_alpha
									super().__init__(is_encoder_decoder=snake_case__   ,     **snake_case__						)




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






									"""simple docstring"""






									return self.encoder_attention_heads




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






									"""simple docstring"""






									return self.d_model






						def  _snake_case					(	self						:   Dict						)      ->int:






									"""simple docstring"""






									a__ :Dict						  =    copy.deepcopy(self.__dict__						)
									a__ :int						  =    self.backbone_config.to_dict()
									a__ :List[str]						  =    self.__class__.model_type
									return output






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__  ,  a__ :Optional[Any]						  =    heap[smallest_child], positions[smallest_child]
															a__  ,  a__ :int						  =    (
															    heap[start],
															    positions[start],
															)
															a__  ,  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))


