"""simple docstring"""






import sys
from collections import defaultdict





class 					_A		:

      def __init__(		self		):







            """simple docstring"""



            lowercase								=      []

      def 							A__			(		self						,			__lowerCAmelCase		):







            """simple docstring"""



            return self.node_position[vertex]

      def 							A__			(		self						,			__lowerCAmelCase						,			__lowerCAmelCase		):







            """simple docstring"""



            lowercase								=      pos

      def 							A__			(		self						,			__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase		):







            """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				,				lowercase								=      heap[smallest_child], positions[smallest_child]
                        lowercase				,				lowercase								=      (
                            heap[start],
                            positions[start],
                        )
                        lowercase				,				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]						,			__lowerCAmelCase		)

                        self.top_to_bottom(__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase		)

      def 							A__			(		self						,			__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase						,			__lowerCAmelCase		):







            """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]						,			__lowerCAmelCase		)
                  else:
                        lowercase								=      val
                        lowercase								=      temp
                        self.set_position(__lowerCAmelCase						,			__lowerCAmelCase		)
                        break
                  lowercase								=      parent
            else:
                  lowercase								=      val
                  lowercase								=      temp
                  self.set_position(__lowerCAmelCase						,			0		)

      def 							A__			(		self						,			__lowerCAmelCase						,			__lowerCAmelCase		):







            """simple docstring"""



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







      def 							A__			(		self						,			__lowerCAmelCase						,			__lowerCAmelCase		):







            """simple docstring"""



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






def      UpperCAmelCase__			(							lowerCAmelCase__	:List[str]						)					->       List[str]:
      '''simple docstring'''


      lowercase								=      Heap()

      lowercase								=      [0] * len(lowerCAmelCase__						)
      lowercase								=      [-1] * len(lowerCAmelCase__						)  # 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(lowerCAmelCase__						)						):
            distance_tv.append(sys.maxsize						)
            positions.append(lowerCAmelCase__						)
            heap.node_position.append(lowerCAmelCase__						)

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

      for _ in range(1   ,						len(lowerCAmelCase__						)						):
            lowercase								=      heap.delete_minimum(lowerCAmelCase__   ,						lowerCAmelCase__						)
            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(lowerCAmelCase__						)]
                        ):
                              lowercase								=      distance
                              heap.bottom_to_top(
                                  lowerCAmelCase__   ,						heap.get_position(lowerCAmelCase__						)   ,						lowerCAmelCase__   ,						lowerCAmelCase__						)
                              lowercase								=      vertex
      return tree_edges


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




"""simple docstring"""






import copy

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


__lowerCAmelCase       :			Tuple   	=logging.get_logger(__name__)

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





class 					_A		(			lowerCAmelCase      ):
      snake_case__     :  Optional[int]				    =      'deta'
      snake_case__     :  Dict				    =      {
          'hidden_size': 'd_model',
          'num_attention_heads': 'encoder_attention_heads',
      }

      def __init__(		self						,			__lowerCAmelCase=None						,			__lowerCAmelCase=900						,			__lowerCAmelCase=2048						,			__lowerCAmelCase=6						,			__lowerCAmelCase=2048						,			__lowerCAmelCase=8						,			__lowerCAmelCase=6						,			__lowerCAmelCase=1024						,			__lowerCAmelCase=8						,			__lowerCAmelCase=0.0						,			__lowerCAmelCase=True						,			__lowerCAmelCase="relu"						,			__lowerCAmelCase=256						,			__lowerCAmelCase=0.1						,			__lowerCAmelCase=0.0						,			__lowerCAmelCase=0.0						,			__lowerCAmelCase=0.0_2						,			__lowerCAmelCase=1.0						,			__lowerCAmelCase=True						,			__lowerCAmelCase=False						,			__lowerCAmelCase="sine"						,			__lowerCAmelCase=5						,			__lowerCAmelCase=4						,			__lowerCAmelCase=4						,			__lowerCAmelCase=True						,			__lowerCAmelCase=300						,			__lowerCAmelCase=True						,			__lowerCAmelCase=True						,			__lowerCAmelCase=1						,			__lowerCAmelCase=5						,			__lowerCAmelCase=2						,			__lowerCAmelCase=1						,			__lowerCAmelCase=1						,			__lowerCAmelCase=5						,			__lowerCAmelCase=2						,			__lowerCAmelCase=0.1						,			__lowerCAmelCase=0.2_5						,			**__lowerCAmelCase						,			):







            """simple docstring"""



            if backbone_config is None:
                  logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""		)
                  lowercase								=      CONFIG_MAPPING["""resnet"""](out_features=["""stage2""", """stage3""", """stage4"""]		)
            else:
                  if isinstance(__lowerCAmelCase						,			__lowerCAmelCase		):
                        lowercase								=      backbone_config.pop("""model_type"""		)
                        lowercase								=      CONFIG_MAPPING[backbone_model_type]
                        lowercase								=      config_class.from_dict(__lowerCAmelCase		)

            lowercase								=      backbone_config
            lowercase								=      num_queries
            lowercase								=      max_position_embeddings
            lowercase								=      d_model
            lowercase								=      encoder_ffn_dim
            lowercase								=      encoder_layers
            lowercase								=      encoder_attention_heads
            lowercase								=      decoder_ffn_dim
            lowercase								=      decoder_layers
            lowercase								=      decoder_attention_heads
            lowercase								=      dropout
            lowercase								=      attention_dropout
            lowercase								=      activation_dropout
            lowercase								=      activation_function
            lowercase								=      init_std
            lowercase								=      init_xavier_std
            lowercase								=      encoder_layerdrop
            lowercase								=      auxiliary_loss
            lowercase								=      position_embedding_type
            # deformable attributes
            lowercase								=      num_feature_levels
            lowercase								=      encoder_n_points
            lowercase								=      decoder_n_points
            lowercase								=      two_stage
            lowercase								=      two_stage_num_proposals
            lowercase								=      with_box_refine
            lowercase								=      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
            lowercase								=      class_cost
            lowercase								=      bbox_cost
            lowercase								=      giou_cost
            # Loss coefficients
            lowercase								=      mask_loss_coefficient
            lowercase								=      dice_loss_coefficient
            lowercase								=      bbox_loss_coefficient
            lowercase								=      giou_loss_coefficient
            lowercase								=      eos_coefficient
            lowercase								=      focal_alpha
            super().__init__(is_encoder_decoder=__lowerCAmelCase						,			**__lowerCAmelCase		)

      @property
      def 							A__			(		self		):







            """simple docstring"""



            return self.encoder_attention_heads

      @property
      def 							A__			(		self		):







            """simple docstring"""



            return self.d_model







      def 							A__			(		self		):







            """simple docstring"""



            lowercase								=      copy.deepcopy(self.__dict__		)
            lowercase								=      self.backbone_config.to_dict()
            lowercase								=      self.__class__.model_type
            return output



