



from collections import deque



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_     ):
			return input(a__     ).strip().split(" "     )



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__         = {}
			for i in range(a__     ):
						lowercase__         = []

			for e in range(a__     ):
						lowercase__     ,				lowercase__         = (int(a__     ) for i in _input(f'''Edge {e + 1}: <node1> <node2> '''     ))
						graph[x].append(a__     )
			return graph



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__         = {}
			for i in range(a__     ):
						lowercase__         = []

			for e in range(a__     ):
						lowercase__     ,				lowercase__         = (int(a__     ) for i in _input(f'''Edge {e + 1}: <node1> <node2> '''     ))
						graph[x].append(a__     )
						graph[y].append(a__     )
			return graph



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__         = {}
			for i in range(a__     ):
						lowercase__         = []

			for e in range(a__     ):
						lowercase__     ,				lowercase__     ,				lowercase__         = (int(a__     ) for i in _input(f'''Edge {e + 1}: <node1> <node2> <weight> '''     ))
						graph[x].append((y, w)     )
						graph[y].append((x, w)     )
			return graph


if __name__ == "__main__":
							lowercase_  =   (int(i) for i in _input("""Number of nodes and edges: """))

							lowercase_  =   int(
							    _input(
							        """Press 1 or 2 or 3 \n"""
							        """1. Unweighted directed \n"""
							        """2. Unweighted undirected \n"""
							        """3. Weighted undirected \n"""
							    )[0]
							)

							lowercase_  =   {
							    1: initialize_unweighted_directed_graph,
							    2: initialize_unweighted_undirected_graph,
							    3: initialize_weighted_undirected_graph,
							}[graph_choice](n, m)



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__     ,				lowercase__         = {s}, [s]
			print(a__     )
			while _s:
						lowercase__         = 0
						for i in g[_s[-1]]:
									if i not in vis:
												_s.append(a__     )
												vis.add(a__     )
												lowercase__         = 1
												print(a__     )
												break
						if not flag:
									_s.pop()



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__     ,				lowercase__         = {s}, deque([s]     )
			print(a__     )
			while q:
						lowercase__         = q.popleft()
						for v in g[u]:
									if v not in vis:
												vis.add(a__     )
												q.append(a__     )
												print(a__     )



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__     ,				lowercase__     ,				lowercase__         = {s: 0}, set(), {s: 0}
			while True:
						if len(a__     ) == len(a__     ) - 1:
									break
						lowercase__         = 10_0000
						for i in dist:
									if i not in known and dist[i] < mini:
												lowercase__         = dist[i]
												lowercase__         = i
						known.add(a__     )
						for v in g[u]:
									if v[0] not in known and dist[u] + v[1] < dist.get(v[0]  ,     10_0000     ):
												lowercase__         = dist[u] + v[1]
												lowercase__         = u
			for i in dist:
						if i != s:
									print(dist[i]     )



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_=None  ,     SCREAMING_SNAKE_CASE_=None     ):
			if q is None:
						lowercase__         = [1]
			if ind is None:
						lowercase__         = [0] * (len(a__     ) + 1)  # SInce oth Index is ignored
						for u in g:
									for v in g[u]:
												ind[v] += 1
						lowercase__         = deque()
						for i in g:
									if ind[i] == 0:
												q.append(a__     )
			if len(a__     ) == 0:
						return
			lowercase__         = q.popleft()
			print(a__     )
			for w in g[v]:
						ind[w] -= 1
						if ind[w] == 0:
									q.append(a__     )
			topo(a__  ,     a__  ,     a__     )



def __lowerCAmelCase       (   ):
			lowercase__         = input().strip()
			lowercase__         = []
			for _ in range(a__     ):
						a.append(map(a__  ,     input().strip().split()     )     )
			return a, n



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_     ):
			((lowercase__)     ,				(lowercase__))         = a_and_n
			lowercase__         = list(a__     )
			lowercase__         = [[0] * n for i in range(a__     )]
			for k in range(a__     ):
						for i in range(a__     ):
									for j in range(a__     ):
												if dist[i][j] > dist[i][k] + dist[k][j]:
															lowercase__         = dist[i][k] + dist[k][j]
															lowercase__         = k
			print(a__     )



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_  ,     SCREAMING_SNAKE_CASE_     ):
			lowercase__     ,				lowercase__     ,				lowercase__         = {s: 0}, set(), {s: 0}
			while True:
						if len(a__     ) == len(a__     ) - 1:
									break
						lowercase__         = 10_0000
						for i in dist:
									if i not in known and dist[i] < mini:
												lowercase__         = dist[i]
												lowercase__         = i
						known.add(a__     )
						for v in g[u]:
									if v[0] not in known and v[1] < dist.get(v[0]  ,     10_0000     ):
												lowercase__         = v[1]
												lowercase__         = u
			return dist



def __lowerCAmelCase       (   ):
			lowercase__     ,				lowercase__         = map(a__  ,     input().split(" "     )     )
			lowercase__         = []
			for _ in range(a__     ):
						edges.append(map(a__  ,     input().split(" "     )     )     )
			return edges, n



def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_     ):
			# Sort edges on the basis of distance
			((lowercase__)     ,				(lowercase__))         = e_and_n
			e.sort(reverse=a__  ,     key=lambda SCREAMING_SNAKE_CASE_     : x[2]     )
			lowercase__         = [{i} for i in range(1  ,     n + 1     )]
			while True:
						if len(a__     ) == 1:
									break
						print(a__     )
						lowercase__         = e.pop()
						for i in range(len(a__     )     ):
									if x[0] in s[i]:
												break
						for j in range(len(a__     )     ):
									if x[1] in s[j]:
												if i == j:
															break
												s[j].update(s[i]     )
												s.pop(a__     )
												break




def __lowerCAmelCase       (   SCREAMING_SNAKE_CASE_     ):
			lowercase__         = []
			for node in graph:
						if not graph[node]:
									isolated.append(a__     )
			return isolated








import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils_fast import AddedToken, PreTrainedTokenizerFast
from ...utils import logging


snake_case_  :	Tuple							  =							logging.get_logger(__name__)

snake_case_  :	int							  =							{'''vocab_file''': '''spiece.model''', '''tokenizer_file''': '''tokenizer.json'''}

snake_case_  :	Dict							  =							{
    '''vocab_file''': {
        '''TsinghuaAI/CPM-Generate''': '''https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/spiece.model''',
    },
    '''tokenizer_file''': {
        '''TsinghuaAI/CPM-Generate''': '''https://huggingface.co/TsinghuaAI/CPM-Generate/resolve/main/tokenizer.json''',
    },
}

class   A__							(						UpperCamelCase__     ):




						def __init__(				self    :					Optional[Any] ,			_a    :					Tuple=None ,			_a    :					Union[str, Any]=None ,			_a    :					Dict=False ,			_a    :					int=True ,			_a    :					str=False ,			_a    :					int="<s>" ,			_a    :					int="</s>" ,			_a    :					Optional[int]="<unk>" ,			_a    :					Dict="<sep>" ,			_a    :					Optional[int]="<pad>" ,			_a    :					str="<cls>" ,			_a    :					List[Any]="<mask>" ,			_a    :					Optional[Any]=["<eop>", "<eod>"] ,			**_a    :					Any ,			)							->   Union[str, Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE	     =AddedToken(_a ,			lstrip=_a ,			rstrip=_a     ) if isinstance(_a ,			_a     ) else mask_token

										super().__init__(
										    vocab_file=_a ,			tokenizer_file=_a ,			do_lower_case=_a ,			remove_space=_a ,			keep_accents=_a ,			bos_token=_a ,			eos_token=_a ,			unk_token=_a ,			sep_token=_a ,			pad_token=_a ,			cls_token=_a ,			mask_token=_a ,			additional_special_tokens=_a ,			**_a ,			)

										_SCREAMING_SNAKE_CASE	     =3
										_SCREAMING_SNAKE_CASE	     =do_lower_case
										_SCREAMING_SNAKE_CASE	     =remove_space
										_SCREAMING_SNAKE_CASE	     =keep_accents
										_SCREAMING_SNAKE_CASE	     =vocab_file
										_SCREAMING_SNAKE_CASE	     =False if not self.vocab_file else True

										try:
														import jieba
										except ModuleNotFoundError as error:
														raise error.__class__(
														    '''You need to install jieba to use CpmTokenizer or CpmTokenizerFast. '''
														    '''See https://pypi.org/project/jieba/ for installation.'''     )
										_SCREAMING_SNAKE_CASE	     =jieba
										_SCREAMING_SNAKE_CASE	     =str.maketrans(''' \n''' ,			'''\u2582\u2583'''     )




						def 							__UpperCamelCase (				self    :					Any ,			_a    :					List[int] ,			_a    :					Optional[List[int]] = None     )							->   List[int]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE	     =[self.sep_token_id]
										_SCREAMING_SNAKE_CASE	     =[self.cls_token_id]
										if token_ids_a is None:
														return token_ids_a + sep + cls
										return token_ids_a + sep + token_ids_a + sep + cls




						def 							__UpperCamelCase (				self    :					Dict ,			_a    :					List[int] ,			_a    :					Optional[List[int]] = None     )							->   List[int]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE	     =[self.sep_token_id]
										_SCREAMING_SNAKE_CASE	     =[2]

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




						def 							__UpperCamelCase (				self    :					str ,			_a    :					str ,			_a    :					Optional[str] = None     )							->   Tuple[str]:


										"""simple docstring"""





										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(_a     ):
														logger.error(f"Vocabulary path ({save_directory}) should be a directory"     )
														return
										_SCREAMING_SNAKE_CASE	     =os.path.join(
										    _a ,			(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']     )

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

										return (out_vocab_file,)




						def 							__UpperCamelCase (				self    :					Dict ,			_a    :					str ,			*_a    :					Optional[int] ,			**_a    :					Any     )							->   int:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE	     =[
										    ''' '''.join([x.translate(self.translator     ) for x in self.jieba.cut(_a ,			cut_all=_a     )]     )
										    for text in batch_text_or_text_pairs
										]
										return super()._batch_encode_plus(_a ,			*_a ,			**_a     )




						def 							__UpperCamelCase (				self    :					List[Any] ,			*_a    :					Union[str, Any] ,			**_a    :					Any     )							->   Optional[Any]:


										"""simple docstring"""





										_SCREAMING_SNAKE_CASE	     =super()._decode(*_a ,			**_a     )
										_SCREAMING_SNAKE_CASE	     =text.replace(''' ''' ,			''''''     ).replace('''\u2582''' ,			''' '''     ).replace('''\u2583''' ,			'''\n'''     )
										return text