



"""simple docstring"""

import sys
from collections import defaultdict







class    __lowercase     :







						"""simple docstring"""







						def __init__(self       ):
											snake_case_					:		Optional[Any] 					=					[]







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											return self.node_position[vertex]







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__       ):
											snake_case_					:		Tuple 					=					pos







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__   ,		lowercase__   ,		lowercase__       ):
											if start > size // 2 - 1:
																return
											else:
																if 2 * start + 2 >= size:
																					snake_case_					:		Tuple 					=					2 * start + 1
																else:
																					if heap[2 * start + 1] < heap[2 * start + 2]:
																										snake_case_					:		Union[str, Any] 					=					2 * start + 1
																					else:
																										snake_case_					:		List[str] 					=					2 * start + 2
																if heap[smallest_child] < heap[start]:
																					snake_case_					,			snake_case_					:		Dict 					=					heap[smallest_child], positions[smallest_child]
																					snake_case_					,			snake_case_					:		Optional[int] 					=					(
																					    heap[start],
																					    positions[start],
																					)
																					snake_case_					,			snake_case_					:		Optional[int] 					=					temp, tempa

																					snake_case_					:		str 					=					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   ,		lowercase__   ,		lowercase__   ,		lowercase__   ,		lowercase__       ):
											snake_case_					:		Any 					=					position[index]

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

																if val < heap[parent]:
																					snake_case_					:		List[str] 					=					heap[parent]
																					snake_case_					:		Dict 					=					position[parent]
																					self.set_position(position[parent]   ,		lowercase__       )
																else:
																					snake_case_					:		Dict 					=					val
																					snake_case_					:		int 					=					temp
																					self.set_position(lowercase__   ,		lowercase__       )
																					break
																snake_case_					:		Any 					=					parent
											else:
																snake_case_					:		int 					=					val
																snake_case_					:		List[Any] 					=					temp
																self.set_position(lowercase__   ,		0       )







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__       ):
											snake_case_					:		Optional[int] 					=					len(lowercase__       ) // 2 - 1
											for i in range(lowercase__   ,		-1   ,		-1       ):
																self.top_to_bottom(lowercase__   ,		lowercase__   ,		len(lowercase__       )   ,		lowercase__       )







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__       ):
											snake_case_					:		List[str] 					=					positions[0]
											snake_case_					:		int 					=					sys.maxsize
											self.top_to_bottom(lowercase__   ,		0   ,		len(lowercase__       )   ,		lowercase__       )
											return temp







def 							SCREAMING_SNAKE_CASE__      (		SCREAMING_SNAKE_CASE__ :  Any			):



					"""simple docstring"""





					snake_case_					:		List[str] 					=					Heap()

					snake_case_					:		List[Any] 					=					[0] * len(SCREAMING_SNAKE_CASE__			)
					snake_case_					:		List[str] 					=					[-1] * len(SCREAMING_SNAKE_CASE__			)  # Neighboring Tree Vertex of selected vertex
					# Minimum Distance of explored vertex with neighboring vertex of partial tree
					# formed in graph
					snake_case_					:		str 					=					[]  # Heap of Distance of vertices from their neighboring vertex
					snake_case_					:		int 					=					[]

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

					snake_case_					:		str 					=					[]
					snake_case_					:		str 					=					1
					snake_case_					:		List[Any] 					=					sys.maxsize
					for neighbor, distance in adjacency_list[0]:
										snake_case_					:		Dict 					=					0
										snake_case_					:		Dict 					=					distance
					heap.heapify(SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)

					for _ in range(1				,    len(SCREAMING_SNAKE_CASE__			)			):
										snake_case_					:		Any 					=					heap.delete_minimum(SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)
										if visited[vertex] == 0:
															tree_edges.append((nbr_tv[vertex], vertex)			)
															snake_case_					:		Tuple 					=					1
															for neighbor, distance in adjacency_list[vertex]:
																				if (
																				    visited[neighbor] == 0
																				    and distance < distance_tv[heap.get_position(SCREAMING_SNAKE_CASE__			)]
																				):
																									snake_case_					:		List[Any] 					=					distance
																									heap.bottom_to_top(
																									    SCREAMING_SNAKE_CASE__				,    heap.get_position(SCREAMING_SNAKE_CASE__			)				,    SCREAMING_SNAKE_CASE__				,    SCREAMING_SNAKE_CASE__			)
																									snake_case_					:		Any 					=					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 os
from shutil import copyfile
from typing import List, Optional, Tuple

from tokenizers import processors

from ...tokenization_utils import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
			from .tokenization_mbart import MBartTokenizer
else:
			a_			   =					None


a_			   =					logging.get_logger(__name__)


a_			   =					{'''vocab_file''': '''sentencepiece.bpe.model''', '''tokenizer_file''': '''tokenizer.json'''}

a_			   =					{
    '''vocab_file''': {
        '''facebook/mbart-large-en-ro''': (
            '''https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/sentencepiece.bpe.model'''
        ),
        '''facebook/mbart-large-cc25''': (
            '''https://huggingface.co/facebook/mbart-large-cc25/resolve/main/sentencepiece.bpe.model'''
        ),
    },
    '''tokenizer_file''': {
        '''facebook/mbart-large-en-ro''': '''https://huggingface.co/facebook/mbart-large-en-ro/resolve/main/tokenizer.json''',
        '''facebook/mbart-large-cc25''': '''https://huggingface.co/facebook/mbart-large-cc25/resolve/main/tokenizer.json''',
    },
}

a_			   =					{
    '''facebook/mbart-large-en-ro''': 1024,
    '''facebook/mbart-large-cc25''': 1024,
}

# fmt: off
a_			   =					['''ar_AR''', '''cs_CZ''', '''de_DE''', '''en_XX''', '''es_XX''', '''et_EE''', '''fi_FI''', '''fr_XX''', '''gu_IN''', '''hi_IN''', '''it_IT''', '''ja_XX''', '''kk_KZ''', '''ko_KR''', '''lt_LT''', '''lv_LV''', '''my_MM''', '''ne_NP''', '''nl_XX''', '''ro_RO''', '''ru_RU''', '''si_LK''', '''tr_TR''', '''vi_VN''', '''zh_CN''']







class    __lowercase     (					_UpperCAmelCase):







						"""simple docstring"""







						_A		:							Dict							       =		VOCAB_FILES_NAMES
						_A		:							Union[str, Any]							       =		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						_A		:							Optional[int]							       =		PRETRAINED_VOCAB_FILES_MAP
						_A		:							str							       =		["""input_ids""", """attention_mask"""]
						_A		:							Tuple							       =		MBartTokenizer

						_A		:							List[int]							       =		[]
						_A		:							List[int]							       =		[]







						def __init__(self   ,		lowercase__=None   ,		lowercase__=None   ,		lowercase__="<s>"   ,		lowercase__="</s>"   ,		lowercase__="</s>"   ,		lowercase__="<s>"   ,		lowercase__="<unk>"   ,		lowercase__="<pad>"   ,		lowercase__="<mask>"   ,		lowercase__=None   ,		lowercase__=None   ,		lowercase__=None   ,		**lowercase__   ,		):
											# Mask token behave like a normal word, i.e. include the space before it
											snake_case_					:		int 					=					AddedToken(lowercase__   ,		lstrip=lowercase__   ,		rstrip=lowercase__       ) if isinstance(lowercase__   ,		lowercase__       ) else mask_token

											super().__init__(
											    vocab_file=lowercase__   ,		tokenizer_file=lowercase__   ,		bos_token=lowercase__   ,		eos_token=lowercase__   ,		sep_token=lowercase__   ,		cls_token=lowercase__   ,		unk_token=lowercase__   ,		pad_token=lowercase__   ,		mask_token=lowercase__   ,		src_lang=lowercase__   ,		tgt_lang=lowercase__   ,		additional_special_tokens=lowercase__   ,		**lowercase__   ,		)

											snake_case_					:		Dict 					=					vocab_file
											snake_case_					:		Optional[int] 					=					False if not self.vocab_file else True

											snake_case_					:		Optional[Any] 					=					FAIRSEQ_LANGUAGE_CODES.copy()

											if additional_special_tokens is not None:
																# Only add those special tokens if they are not already there.
																_additional_special_tokens.extend(
																    [t for t in additional_special_tokens if t not in _additional_special_tokens]       )

											self.add_special_tokens({"""additional_special_tokens""": _additional_special_tokens}       )
											snake_case_					:		Any 					=					{
											    lang_code: self.convert_tokens_to_ids(lowercase__       ) for lang_code in FAIRSEQ_LANGUAGE_CODES
											}

											snake_case_					:		Tuple 					=					src_lang if src_lang is not None else """en_XX"""
											snake_case_					:		Tuple 					=					self.convert_tokens_to_ids(self._src_lang       )
											snake_case_					:		Tuple 					=					tgt_lang
											self.set_src_lang_special_tokens(self._src_lang       )







						@property
						def 						__UpperCamelCase							(self       ):
											return self._src_lang







						@src_lang.setter
						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											snake_case_					:		Tuple 					=					new_src_lang
											self.set_src_lang_special_tokens(self._src_lang       )







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__ = None       ):
											if token_ids_a is None:
																return self.prefix_tokens + token_ids_a + self.suffix_tokens
											# We don't expect to process pairs, but leave the pair logic for API consistency
											return self.prefix_tokens + token_ids_a + token_ids_a + self.suffix_tokens







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__ = None       ):
											snake_case_					:		List[Any] 					=					[self.sep_token_id]
											snake_case_					:		Optional[int] 					=					[self.cls_token_id]

											if token_ids_a is None:
																return len(cls + token_ids_a + sep       ) * [0]
											return len(cls + token_ids_a + sep + sep + token_ids_a + sep       ) * [0]







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__   ,		lowercase__   ,		lowercase__   ,		**lowercase__       ):
											if src_lang is None or tgt_lang is None:
																raise ValueError("""Translation requires a `src_lang` and a `tgt_lang` for this model"""       )
											snake_case_					:		int 					=					src_lang
											snake_case_					:		List[str] 					=					self(lowercase__   ,		add_special_tokens=lowercase__   ,		return_tensors=lowercase__   ,		**lowercase__       )
											snake_case_					:		List[str] 					=					self.convert_tokens_to_ids(lowercase__       )
											snake_case_					:		Union[str, Any] 					=					tgt_lang_id
											return inputs







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__ = "en_XX"   ,		lowercase__ = None   ,		lowercase__ = "ro_RO"   ,		**lowercase__   ,		):
											snake_case_					:		List[str] 					=					src_lang
											snake_case_					:		int 					=					tgt_lang
											return super().prepare_seqaseq_batch(lowercase__   ,		lowercase__   ,		**lowercase__       )







						def 						__UpperCamelCase							(self       ):
											return self.set_src_lang_special_tokens(self.src_lang       )







						def 						__UpperCamelCase							(self       ):
											return self.set_tgt_lang_special_tokens(self.tgt_lang       )







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											snake_case_					:		int 					=					self.convert_tokens_to_ids(lowercase__       )
											snake_case_					:		Tuple 					=					[]
											snake_case_					:		List[Any] 					=					[self.eos_token_id, self.cur_lang_code]

											snake_case_					:		List[Any] 					=					self.convert_ids_to_tokens(self.prefix_tokens       )
											snake_case_					:		Union[str, Any] 					=					self.convert_ids_to_tokens(self.suffix_tokens       )

											snake_case_					:		Optional[int] 					=					processors.TemplateProcessing(
											    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str   ,		pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str   ,		special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str   ,		self.prefix_tokens + self.suffix_tokens       )       )   ,		)







						def 						__UpperCamelCase							(self   ,		lowercase__       ):
											snake_case_					:		Tuple 					=					self.convert_tokens_to_ids(lowercase__       )
											snake_case_					:		Optional[int] 					=					[]
											snake_case_					:		Optional[Any] 					=					[self.eos_token_id, self.cur_lang_code]

											snake_case_					:		Union[str, Any] 					=					self.convert_ids_to_tokens(self.prefix_tokens       )
											snake_case_					:		int 					=					self.convert_ids_to_tokens(self.suffix_tokens       )

											snake_case_					:		List[Any] 					=					processors.TemplateProcessing(
											    single=prefix_tokens_str + ["""$A"""] + suffix_tokens_str   ,		pair=prefix_tokens_str + ["""$A""", """$B"""] + suffix_tokens_str   ,		special_tokens=list(zip(prefix_tokens_str + suffix_tokens_str   ,		self.prefix_tokens + self.suffix_tokens       )       )   ,		)







						def 						__UpperCamelCase							(self   ,		lowercase__   ,		lowercase__ = None       ):
											if not self.can_save_slow_tokenizer:
																raise ValueError(
																    """Your fast tokenizer does not have the necessary information to save the vocabulary for a slow """
																    """tokenizer."""       )

											if not os.path.isdir(lowercase__       ):
																logger.error(f'Vocabulary path ({save_directory}) should be a directory.'       )
																return
											snake_case_					:		List[str] 					=					os.path.join(
											    lowercase__   ,		(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]       )

											if os.path.abspath(self.vocab_file       ) != os.path.abspath(lowercase__       ):
																copyfile(self.vocab_file   ,		lowercase__       )

											return (out_vocab_file,)




