






import sys
from collections import defaultdict
class     a    :



      """simple docstring"""


      def __init__(      self					:			Optional[Any]					)							->      Any:
        __UpperCAmelCase							:	Tuple           =  []
      def 	UpperCAmelCase      (      self					:			int		,      __lowercase					:			Tuple					)							->      str:
        return self.node_position[vertex]
      def 	UpperCAmelCase      (      self					:			int		,      __lowercase					:			List[str]		,      __lowercase					:			List[Any]					)							->      List[str]:
        __UpperCAmelCase							:	Dict           =  pos
      def 	UpperCAmelCase      (      self					:			Any		,      __lowercase					:			Tuple		,      __lowercase					:			Any		,      __lowercase					:			Optional[Any]		,      __lowercase					:			List[Any]					)							->      int:
        if start > size // 2 - 1:
          return
        else:
          if 2 * start + 2 >= size:
            __UpperCAmelCase							:	Optional[int]           =  2 * start + 1
          else:
            if heap[2 * start + 1] < heap[2 * start + 2]:
              __UpperCAmelCase							:	Optional[Any]           =  2 * start + 1
            else:
              __UpperCAmelCase							:	str           =  2 * start + 2
          if heap[smallest_child] < heap[start]:
            __UpperCAmelCase      , __UpperCAmelCase							:	List[str]           =  heap[smallest_child], positions[smallest_child]
            __UpperCAmelCase      , __UpperCAmelCase							:	List[Any]           =  (
                heap[start],
                positions[start],
            )
            __UpperCAmelCase      , __UpperCAmelCase							:	Union[str, Any]           =  temp, tempa

            __UpperCAmelCase							:	Optional[int]           =  self.get_position(positions[smallest_child]					)
            self.set_position(
                positions[smallest_child]		,      self.get_position(positions[start]					)					)
            self.set_position(positions[start]		,      __lowercase					)

            self.top_to_bottom(__lowercase		,      __lowercase		,      __lowercase		,      __lowercase					)
      def 	UpperCAmelCase      (      self					:			int		,      __lowercase					:			Any		,      __lowercase					:			Optional[Any]		,      __lowercase					:			Optional[int]		,      __lowercase					:			str					)							->      Any:
        __UpperCAmelCase							:	Optional[int]           =  position[index]

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

          if val < heap[parent]:
            __UpperCAmelCase							:	str           =  heap[parent]
            __UpperCAmelCase							:	int           =  position[parent]
            self.set_position(position[parent]		,      __lowercase					)
          else:
            __UpperCAmelCase							:	Any           =  val
            __UpperCAmelCase							:	Tuple           =  temp
            self.set_position(__lowercase		,      __lowercase					)
            break
          __UpperCAmelCase							:	Union[str, Any]           =  parent
        else:
          __UpperCAmelCase							:	Dict           =  val
          __UpperCAmelCase							:	Any           =  temp
          self.set_position(__lowercase		,      0					)
      def 	UpperCAmelCase      (      self					:			Union[str, Any]		,      __lowercase					:			str		,      __lowercase					:			List[str]					)							->      Optional[int]:
        __UpperCAmelCase							:	Tuple           =  len(__lowercase					) // 2 - 1
        for i in range(__lowercase		,      -1		,      -1					):
          self.top_to_bottom(__lowercase		,      __lowercase		,      len(__lowercase					)		,      __lowercase					)




      def 	UpperCAmelCase      (      self					:			Dict		,      __lowercase					:			Dict		,      __lowercase					:			int					)							->      Any:
        __UpperCAmelCase							:	str           =  positions[0]
        __UpperCAmelCase							:	str           =  sys.maxsize
        self.top_to_bottom(__lowercase		,      0		,      len(__lowercase					)		,      __lowercase					)
        return temp






def 				lowerCamelCase__      (    __lowerCamelCase			:     Tuple		):
  __UpperCAmelCase							:	Union[str, Any]           =  Heap()

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

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

  __UpperCAmelCase							:	Any           =  []
  __UpperCAmelCase							:	Tuple           =  1
  __UpperCAmelCase							:	Optional[int]           =  sys.maxsize
  for neighbor, distance in adjacency_list[0]:
    __UpperCAmelCase							:	int           =  0
    __UpperCAmelCase							:	Union[str, Any]           =  distance
  heap.heapify(__lowerCamelCase  ,		__lowerCamelCase		)

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


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










import warnings

from ...configuration_utils import PretrainedConfig
from ...utils import logging


a		:       Tuple			     = logging.get_logger(__name__)

a		:       Optional[Any]			     = {
    "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json",
}
class     a    ( lowercase__   ):



      """simple docstring"""


      a  : str							       =	'mvp'
      a  : Optional[Any]							       =	['past_key_values']
      a  : int							       =	{'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}
      def __init__(      self					:			Dict		,      __lowercase					:			Tuple=50267		,      __lowercase					:			Optional[int]=1024		,      __lowercase					:			Any=12		,      __lowercase					:			List[Any]=4096		,      __lowercase					:			Optional[Any]=16		,      __lowercase					:			List[str]=12		,      __lowercase					:			Optional[Any]=4096		,      __lowercase					:			Tuple=16		,      __lowercase					:			Union[str, Any]=0.0		,      __lowercase					:			str=0.0		,      __lowercase					:			Any="gelu"		,      __lowercase					:			Any=1024		,      __lowercase					:			List[str]=0.1		,      __lowercase					:			List[Any]=0.0		,      __lowercase					:			int=0.0		,      __lowercase					:			str=0.02		,      __lowercase					:			Tuple=0.0		,      __lowercase					:			Union[str, Any]=False		,      __lowercase					:			Dict=True		,      __lowercase					:			List[Any]=1		,      __lowercase					:			Optional[Any]=0		,      __lowercase					:			Union[str, Any]=2		,      __lowercase					:			Optional[int]=True		,      __lowercase					:			Dict=2		,      __lowercase					:			int=2		,      __lowercase					:			Union[str, Any]=False		,      __lowercase					:			Union[str, Any]=100		,      __lowercase					:			str=800		,      **__lowercase					:			Union[str, Any]		,      )							->      Any:
        __UpperCAmelCase							:	List[str]           =  vocab_size
        __UpperCAmelCase							:	Union[str, Any]           =  max_position_embeddings
        __UpperCAmelCase							:	Optional[Any]           =  d_model
        __UpperCAmelCase							:	int           =  encoder_ffn_dim
        __UpperCAmelCase							:	Tuple           =  encoder_layers
        __UpperCAmelCase							:	List[str]           =  encoder_attention_heads
        __UpperCAmelCase							:	Any           =  decoder_ffn_dim
        __UpperCAmelCase							:	List[Any]           =  decoder_layers
        __UpperCAmelCase							:	str           =  decoder_attention_heads
        __UpperCAmelCase							:	Optional[int]           =  dropout
        __UpperCAmelCase							:	Tuple           =  attention_dropout
        __UpperCAmelCase							:	int           =  activation_dropout
        __UpperCAmelCase							:	List[Any]           =  activation_function
        __UpperCAmelCase							:	Tuple           =  init_std
        __UpperCAmelCase							:	Any           =  encoder_layerdrop
        __UpperCAmelCase							:	Union[str, Any]           =  decoder_layerdrop
        __UpperCAmelCase							:	List[Any]           =  classifier_dropout
        __UpperCAmelCase							:	Optional[int]           =  use_cache
        __UpperCAmelCase							:	int           =  encoder_layers
        __UpperCAmelCase							:	Union[str, Any]           =  scale_embedding  # scale factor will be sqrt(d_model) if True
        __UpperCAmelCase							:	Tuple           =  use_prompt
        __UpperCAmelCase							:	str           =  prompt_length
        __UpperCAmelCase							:	Union[str, Any]           =  prompt_mid_dim

        super().__init__(
            pad_token_id=__lowercase		,      bos_token_id=__lowercase		,      eos_token_id=__lowercase		,      is_encoder_decoder=__lowercase		,      decoder_start_token_id=__lowercase		,      forced_eos_token_id=__lowercase		,      **__lowercase		,      )

        if self.forced_bos_token_id is None and kwargs.get("""force_bos_token_to_be_generated"""		,      __lowercase					):
          __UpperCAmelCase							:	Optional[Any]           =  self.bos_token_id
          warnings.warn(
              f"""Please make sure the config includes `forced_bos_token_id={self.bos_token_id}` in future versions. """
              """The config can simply be saved and uploaded again to be fixed."""					)


