




from typing import List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_clip import CLIPTokenizer


__SCREAMING_SNAKE_CASE    :   str       =logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE    :   Tuple       ={"""vocab_file""": """vocab.json""", """merges_file""": """merges.txt""", """tokenizer_file""": """tokenizer.json"""}

__SCREAMING_SNAKE_CASE    :   Tuple       ={
    """vocab_file""": {
        """openai/clip-vit-base-patch32""": """https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/vocab.json""",
    },
    """merges_file""": {
        """openai/clip-vit-base-patch32""": """https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/merges.txt""",
    },
    """tokenizer_file""": {
        """openai/clip-vit-base-patch32""": (
            """https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/tokenizer.json"""
        ),
    },
}

__SCREAMING_SNAKE_CASE    :   Optional[Any]       ={
    """openai/clip-vit-base-patch32""": 77,
}






class 			A			(		_lowerCAmelCase		):
     """simple docstring"""

     _snake_case:	Union[str, Any]     =VOCAB_FILES_NAMES
     _snake_case:	int     =PRETRAINED_VOCAB_FILES_MAP
     _snake_case:	Tuple     =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     _snake_case:	Optional[int]     =["input_ids", "attention_mask"]
     _snake_case:	List[str]     =CLIPTokenizer




     def __init__(    self  :   Any	,  A__  :   List[Any]=None	,  A__  :   str=None	,  A__  :   Tuple=None	,  A__  :   List[Any]="<|endoftext|>"	,  A__  :   Optional[int]="<|startoftext|>"	,  A__  :   List[Any]="<|endoftext|>"	,  A__  :   Tuple="<|endoftext|>"	,  **A__  :   int	,  )				->       str:
           super().__init__(
               A__	,  A__	,  tokenizer_file=A__	,  unk_token=A__	,  bos_token=A__	,  eos_token=A__	,  pad_token=A__	,  **A__	,  )

           if not isinstance(self.backend_tokenizer.pre_tokenizer	,  pre_tokenizers.Sequence			):
                 raise ValueError(
                     'The `backend_tokenizer` provided does not match the expected format. The CLIP tokenizer has been'
                     ' heavily modified from transformers version 4.17.0. You need to convert the tokenizer you are using'
                     ' to be compatible with this version.The easiest way to do so is'
                     ' `CLIPTokenizerFast.from_pretrained("path_to_local_folder_or_hub_repo, from_slow=True)`. If you want'
                     ' to use your existing tokenizer, you will have to revert to a version prior to 4.17.0 of'
                     ' transformers.'			)

           self._wrap_decode_method_backend_tokenizer()




     def  __snake_case   (    self  :   Optional[int]			)				->       Any:
           lowerCamelCase__        =				self.backend_tokenizer.decode

           def new_decode_method(*A__  :   Union[str, Any]	,  **A__  :   Union[str, Any]			):
                 lowerCamelCase__        =				orig_decode_method(*A__	,  **A__			)
                 lowerCamelCase__        =				text.replace(self.backend_tokenizer.model.end_of_word_suffix	,  ' '			).strip()
                 return text

           lowerCamelCase__        =				new_decode_method




     def  __snake_case   (    self  :   Optional[Any]	,  A__  :   List[int]	,  A__  :   Optional[List[int]] = None			)				->       List[int]:
           lowerCamelCase__        =				[self.bos_token_id]
           lowerCamelCase__        =				[self.eos_token_id]

           if token_ids_a is None:
                 return bos_token + token_ids_a + eos_token
           return bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token




     def  __snake_case   (    self  :   Any	,  A__  :   List[int]	,  A__  :   Optional[List[int]] = None			)				->       List[int]:
           lowerCamelCase__        =				[self.bos_token_id]
           lowerCamelCase__        =				[self.eos_token_id]

           if token_ids_a is None:
                 return len(bos_token + token_ids_a + eos_token			) * [0]
           return len(bos_token + token_ids_a + eos_token + eos_token + token_ids_a + eos_token			) * [0]




     def  __snake_case   (    self  :   str	,  A__  :   str	,  A__  :   Optional[str] = None			)				->       Tuple[str]:
           lowerCamelCase__        =				self._tokenizer.model.save(A__	,  name=A__			)
           return tuple(A__			)





def 			lowerCAmelCase_			(  lowerCamelCase:       int     ,				lowerCamelCase:       list[tuple[int, int, int]]						)					->			list[tuple[int, int, int]]:


      '''simple docstring'''




      lowerCamelCase__        =				sorted(lowerCamelCase     ,				key=lambda lowerCamelCase						: edge[2]						)

      lowerCamelCase__        =				list(range(lowerCamelCase						)						)

      def find_parent(lowerCamelCase:       int						):
            if i != parent[i]:
                  lowerCamelCase__        =				find_parent(parent[i]						)
            return parent[i]

      lowerCamelCase__        =				0
      lowerCamelCase__        =				[]

      for edge in edges:
            lowerCamelCase__        =				find_parent(edge[0]						)
            lowerCamelCase__        =				find_parent(edge[1]						)
            if parent_a != parent_b:
                  minimum_spanning_tree_cost += edge[2]
                  minimum_spanning_tree.append(lowerCamelCase						)
                  lowerCamelCase__        =				parent_b

      return minimum_spanning_tree


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

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

      kruskal(num_nodes, edges)