


"""simple docstring"""







from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


__lowercase          = logging.get_logger(__name__)






class 		_A    (    _a    ):







    """simple docstring"""




    UpperCAmelCase			:				Dict      =			["""input_ids""", """attention_mask"""]






    def __init__(   self							:       str							,					__UpperCAmelCase							:       Tuple="[PAD]"							,					__UpperCAmelCase							:       List[str]="[BOS]"							,					__UpperCAmelCase							:       Any="[EOS]"							,					__UpperCAmelCase							:       str="[MASK]"							,					__UpperCAmelCase							:       Optional[int]="[CLS]"							,					__UpperCAmelCase							:       int="[SEP]"							,					__UpperCAmelCase							:       Optional[Any]=2048							,					**__UpperCAmelCase							:       Any							,					):
      a		:						Union[str, Any] 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else pad_token
      a		:						List[Any] 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else bos_token
      a		:						List[str] 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else eos_token
      a		:						Dict 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else mask_token
      a		:						Tuple 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else cls_token
      a		:						Dict 				=     AddedToken(__UpperCAmelCase							,					lstrip=__UpperCAmelCase							,					rstrip=__UpperCAmelCase) if isinstance(__UpperCAmelCase							,					__UpperCAmelCase) else sep_token

      super().__init__(
          pad_token=__UpperCAmelCase							,					bos_token=__UpperCAmelCase							,					eos_token=__UpperCAmelCase							,					mask_token=__UpperCAmelCase							,					cls_token=__UpperCAmelCase							,					sep_token=__UpperCAmelCase							,					model_max_length=__UpperCAmelCase							,					**__UpperCAmelCase							,					)

      a		:						int 				=     2**8  # utf is 8 bits

      # define special tokens dict
      a		:						Dict[str, int] 				=     {
          self.pad_token: 0,
          self.bos_token: 1,
          self.eos_token: 2,
          self.mask_token: 3,
          self.cls_token: 4,
          self.sep_token: 5,
      }
      a		:						Dict 				=     len(self.special_tokens_encoder)
      a		:						Dict[int, str] 				=     {v: k for k, v in self.special_tokens_encoder.items()}






    def       __snake_case				(   self							:       str):
      a		:						Dict 				=     self.special_tokens_encoder.copy()
      vocab.update(self.added_tokens_encoder)
      for i in range(self._utf_vocab_size):
        a		:						Optional[Any] 				=     chr(__UpperCAmelCase)
        a		:						Any 				=     i + len(self.special_tokens_encoder)
      return vocab






    @property
    def       __snake_case				(   self							:       Optional[Any]):
      return self._utf_vocab_size + self._num_special_tokens






    def       __snake_case				(   self							:       Union[str, Any]							,					__UpperCAmelCase							:       List[int]							,					__UpperCAmelCase							:       Optional[List[int]] = None							,					__UpperCAmelCase							:       bool = False):
      if already_has_special_tokens:
        return super().get_special_tokens_mask(
            token_ids_a=__UpperCAmelCase							,					token_ids_a=__UpperCAmelCase							,					already_has_special_tokens=__UpperCAmelCase)

      # normal case: some special tokens
      if token_ids_a is None:
        return [1] + [0] * len(__UpperCAmelCase) + [1]
      return [1] + ([0] * len(__UpperCAmelCase)) + [1] + ([0] * len(__UpperCAmelCase)) + [1]






    def       __snake_case				(   self							:       List[str]							,					__UpperCAmelCase							:       List[int]							,					__UpperCAmelCase							:       Optional[List[int]] = None):
      if token_ids_a is None:
        return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
      else:
        return [self.cls_token_id] + token_ids_a + [self.sep_token_id] + token_ids_a + [self.sep_token_id]






    def       __snake_case				(   self							:       Dict							,					__UpperCAmelCase							:       str):
      a		:						str 				=     [chr(__UpperCAmelCase) for i in text.encode("utf-8")]
      return tokens






    def       __snake_case				(   self							:       List[Any]							,					__UpperCAmelCase							:       Dict):
      if token in self.special_tokens_encoder:
        a		:						Dict 				=     self.special_tokens_encoder[token]
      elif token in self.added_tokens_encoder:
        a		:						Any 				=     self.added_tokens_encoder[token]
      elif len(__UpperCAmelCase) != 1:
        a		:						List[str] 				=     self.unk_token_id
      else:
        a		:						Union[str, Any] 				=     ord(__UpperCAmelCase) + self._num_special_tokens
      return token_id






    def       __snake_case				(   self							:       List[str]							,					__UpperCAmelCase							:       Optional[Any]):
      if index in self.special_tokens_decoder:
        a		:						str 				=     self.special_tokens_decoder[index]
      elif index in self.added_tokens_decoder:
        a		:						Optional[int] 				=     self.added_tokens_decoder[index]
      else:
        a		:						Optional[int] 				=     chr(index - self._num_special_tokens)
      return token






    def       __snake_case				(   self							:       List[str]							,					__UpperCAmelCase							:       List[Any]):
      a		:						Tuple 				=     B""
      for token in tokens:
        if token in self.special_tokens_decoder:
          a		:						Optional[Any] 				=     self.special_tokens_decoder[token].encode("utf-8")
        elif token in self.added_tokens_decoder:
          a		:						Dict 				=     self.special_tokens_decoder[token].encode("utf-8")
        elif token in self.special_tokens_encoder:
          a		:						int 				=     token.encode("utf-8")
        elif token in self.added_tokens_encoder:
          a		:						Union[str, Any] 				=     token.encode("utf-8")
        else:
          a		:						List[Any] 				=     bytes([ord(__UpperCAmelCase)])
        bstring += tok_string
      a		:						Any 				=     bstring.decode("utf-8"							,					errors="replace")
      return string






    def       __snake_case				(   self							:       Any							,					__UpperCAmelCase							:       str							,					__UpperCAmelCase							:       Optional[str] = None):
      return ()










"""simple docstring"""







def 	lowercase     (							A_    ,  A_			)-> list[tuple[int, int, int]]:
  '''simple docstring'''







  a		:						Union[str, Any] 				=     sorted(A_    ,  key=lambda A_			: edge[2]			)

  a		:						List[Any] 				=     list(range(A_			)			)

  def find_parent(A_			):
    if i != parent[i]:
      a		:						Dict 				=     find_parent(parent[i]			)
    return parent[i]

  a		:						Optional[Any] 				=     0
  a		:						Optional[int] 				=     []

  for edge in edges:
    a		:						List[str] 				=     find_parent(edge[0]			)
    a		:						int 				=     find_parent(edge[1]			)
    if parent_a != parent_b:
      minimum_spanning_tree_cost += edge[2]
      minimum_spanning_tree.append(A_			)
      a		:						Tuple 				=     parent_b

  return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
 __lowercase   ,				__lowercase          = list(map(int, input().strip().split()))
 __lowercase          = []

 for _ in range(num_edges):
  __lowercase   ,				__lowercase   ,				__lowercase          = (int(x) for x in input().strip().split())
  edges.append((nodea, nodea, cost))

 kruskal(num_nodes, edges)






