
'''simple docstring'''



import sys
from collections import defaultdict





class 	A							:



			def __init__(    self				)	->						str:




									'''simple docstring'''



									lowercase__							       =				[]



			def A__       (    self				,   lowerCamelCase__				)	->						Optional[Any]:




									'''simple docstring'''



									return self.node_position[vertex]



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




									'''simple docstring'''



									lowercase__							       =				pos



			def A__       (    self				,   lowerCamelCase__				,   lowerCamelCase__				,   lowerCamelCase__				,   lowerCamelCase__				)	->						Optional[int]:




									'''simple docstring'''



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

																					lowercase__							       =				self.get_position(positions[smallest_child]				)
																					self.set_position(
																					    positions[smallest_child]				,   self.get_position(positions[start]				)				)
																					self.set_position(positions[start]				,   _SCREAMING_SNAKE_CASE				)

																					self.top_to_bottom(_SCREAMING_SNAKE_CASE				,   _SCREAMING_SNAKE_CASE				,   _SCREAMING_SNAKE_CASE				,   _SCREAMING_SNAKE_CASE				)



			def A__       (    self				,   lowerCamelCase__				,   lowerCamelCase__				,   lowerCamelCase__				,   lowerCamelCase__				)	->						str:




									'''simple docstring'''



									lowercase__							       =				position[index]

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

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



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




									'''simple docstring'''



									lowercase__							       =				len(_SCREAMING_SNAKE_CASE				) // 2 - 1
									for i in range(_SCREAMING_SNAKE_CASE				,   -1				,   -1				):
															self.top_to_bottom(_SCREAMING_SNAKE_CASE				,   _SCREAMING_SNAKE_CASE				,   len(_SCREAMING_SNAKE_CASE				)				,   _SCREAMING_SNAKE_CASE				)



			def A__       (    self				,   lowerCamelCase__				,   lowerCamelCase__				)	->						int:




									'''simple docstring'''



									lowercase__							       =				positions[0]
									lowercase__							       =				sys.maxsize
									self.top_to_bottom(_SCREAMING_SNAKE_CASE				,   0				,   len(_SCREAMING_SNAKE_CASE				)				,   _SCREAMING_SNAKE_CASE				)
									return temp





def        _A						(							lowercase__		):
						lowercase__							       =				Heap()

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

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

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

						for _ in range(1						,						len(lowercase__		)		):
												lowercase__							       =				heap.delete_minimum(lowercase__						,						lowercase__		)
												if visited[vertex] == 0:
																		tree_edges.append((nbr_tv[vertex], vertex)		)
																		lowercase__							       =				1
																		for neighbor, distance in adjacency_list[vertex]:
																								if (
																								    visited[neighbor] == 0
																								    and distance < distance_tv[heap.get_position(lowercase__		)]
																								):
																														lowercase__							       =				distance
																														heap.bottom_to_top(
																														    lowercase__						,						heap.get_position(lowercase__		)						,						lowercase__						,						lowercase__		)
																														lowercase__							       =				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))











"""simple docstring"""
import copy
from collections import OrderedDict
from typing import Mapping

from packaging import version

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


A:   List[str]								=		logging.get_logger(__name__)

A:   Dict								=		{
    "microsoft/conditional-detr-resnet-50": (
        "https://huggingface.co/microsoft/conditional-detr-resnet-50/resolve/main/config.json"
    ),
}



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):
   __lowerCAmelCase  :   Any						=						'conditional_detr'
   __lowerCAmelCase  :   Union[str, Any]						=						['past_key_values']
   __lowerCAmelCase  :   int						=						{
       'hidden_size': 'd_model',
       'num_attention_heads': 'encoder_attention_heads',
   }

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=None      ,     _SCREAMING_SNAKE_CASE=3      ,     _SCREAMING_SNAKE_CASE=300      ,     _SCREAMING_SNAKE_CASE=6      ,     _SCREAMING_SNAKE_CASE=2048      ,     _SCREAMING_SNAKE_CASE=8      ,     _SCREAMING_SNAKE_CASE=6      ,     _SCREAMING_SNAKE_CASE=2048      ,     _SCREAMING_SNAKE_CASE=8      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE="relu"      ,     _SCREAMING_SNAKE_CASE=256      ,     _SCREAMING_SNAKE_CASE=0.1      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.02      ,     _SCREAMING_SNAKE_CASE=1.0      ,     _SCREAMING_SNAKE_CASE=False      ,     _SCREAMING_SNAKE_CASE="sine"      ,     _SCREAMING_SNAKE_CASE="resnet50"      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=False      ,     _SCREAMING_SNAKE_CASE=2      ,     _SCREAMING_SNAKE_CASE=5      ,     _SCREAMING_SNAKE_CASE=2      ,     _SCREAMING_SNAKE_CASE=1      ,     _SCREAMING_SNAKE_CASE=1      ,     _SCREAMING_SNAKE_CASE=2      ,     _SCREAMING_SNAKE_CASE=5      ,     _SCREAMING_SNAKE_CASE=2      ,     _SCREAMING_SNAKE_CASE=0.25      ,     **_SCREAMING_SNAKE_CASE      ,     )  ->      Tuple:





    '''simple docstring'''




    if backbone_config is not None and use_timm_backbone:
     raise ValueError("""You can't specify both `backbone_config` and `use_timm_backbone`."""						)

    if not use_timm_backbone:
     if backbone_config is None:
      logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""						)
      UpperCAmelCase	:					Tuple	=	CONFIG_MAPPING["""resnet"""](out_features=["""stage4"""]						)
     elif isinstance(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						):
      UpperCAmelCase	:					str	=	backbone_config.get("""model_type"""						)
      UpperCAmelCase	:					int	=	CONFIG_MAPPING[backbone_model_type]
      UpperCAmelCase	:					Union[str, Any]	=	config_class.from_dict(_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					Union[str, Any]	=	use_timm_backbone
    UpperCAmelCase	:					Optional[int]	=	backbone_config
    UpperCAmelCase	:					List[str]	=	num_channels
    UpperCAmelCase	:					Any	=	num_queries
    UpperCAmelCase	:					Union[str, Any]	=	d_model
    UpperCAmelCase	:					List[str]	=	encoder_ffn_dim
    UpperCAmelCase	:					Optional[int]	=	encoder_layers
    UpperCAmelCase	:					Union[str, Any]	=	encoder_attention_heads
    UpperCAmelCase	:					Optional[Any]	=	decoder_ffn_dim
    UpperCAmelCase	:					Any	=	decoder_layers
    UpperCAmelCase	:					Optional[int]	=	decoder_attention_heads
    UpperCAmelCase	:					Optional[int]	=	dropout
    UpperCAmelCase	:					Dict	=	attention_dropout
    UpperCAmelCase	:					Dict	=	activation_dropout
    UpperCAmelCase	:					Any	=	activation_function
    UpperCAmelCase	:					Any	=	init_std
    UpperCAmelCase	:					Tuple	=	init_xavier_std
    UpperCAmelCase	:					Optional[int]	=	encoder_layerdrop
    UpperCAmelCase	:					Any	=	decoder_layerdrop
    UpperCAmelCase	:					Any	=	encoder_layers
    UpperCAmelCase	:					Optional[Any]	=	auxiliary_loss
    UpperCAmelCase	:					List[Any]	=	position_embedding_type
    UpperCAmelCase	:					Union[str, Any]	=	backbone
    UpperCAmelCase	:					List[Any]	=	use_pretrained_backbone
    UpperCAmelCase	:					Dict	=	dilation
    # Hungarian matcher
    UpperCAmelCase	:					Optional[int]	=	class_cost
    UpperCAmelCase	:					List[str]	=	bbox_cost
    UpperCAmelCase	:					List[str]	=	giou_cost
    # Loss coefficients
    UpperCAmelCase	:					List[Any]	=	mask_loss_coefficient
    UpperCAmelCase	:					List[str]	=	dice_loss_coefficient
    UpperCAmelCase	:					Optional[int]	=	cls_loss_coefficient
    UpperCAmelCase	:					Union[str, Any]	=	bbox_loss_coefficient
    UpperCAmelCase	:					Union[str, Any]	=	giou_loss_coefficient
    UpperCAmelCase	:					int	=	focal_alpha
    super().__init__(is_encoder_decoder=_SCREAMING_SNAKE_CASE      ,     **_SCREAMING_SNAKE_CASE						)

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return self.encoder_attention_heads

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return self.d_model




   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Any:





    '''simple docstring'''




    UpperCAmelCase	:					List[Any]	=	copy.deepcopy(self.__dict__						)
    if self.backbone_config is not None:
     UpperCAmelCase	:					Union[str, Any]	=	self.backbone_config.to_dict()
    UpperCAmelCase	:					Dict	=	self.__class__.model_type
    return output



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):
   __lowerCAmelCase  :   Any						=						version.parse('1.11' )

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      Mapping[str, Mapping[int, str]]:





    '''simple docstring'''




    return OrderedDict(
        [
            ("""pixel_values""", {0: """batch""", 1: """num_channels""", 2: """height""", 3: """width"""}),
            ("""pixel_mask""", {0: """batch"""}),
        ]						)

   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      float:





    '''simple docstring'''




    return 1E-5




   @property
   def 	SCREAMING_SNAKE_CASE     (   self						)  ->      int:





    '''simple docstring'''




    return 12
