


from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass







@dataclass
class 							UpperCamelCase__ :
					__SCREAMING_SNAKE_CASE							:	Union[str, Any]            = 42
					__SCREAMING_SNAKE_CASE							:	Any            = 42







class 							UpperCamelCase__ :

					def __init__(  self							: str				,       UpperCamelCase__							: int							):






										'''simple docstring'''






										lowercase_					=      [[] for _ in range(__UpperCAmelCase							)]
										lowercase_					=      size

					def __getitem__(  self							: Optional[Any]				,       UpperCamelCase__							: int							):






										'''simple docstring'''






										return iter(self._graph[vertex]							)

					@property
					def 	UpperCAmelCase__							(  self							: Dict							):






										'''simple docstring'''






										return self._size

					def 	UpperCAmelCase__							(  self							: Optional[int]				,       UpperCamelCase__							: int				,       UpperCamelCase__							: int				,       UpperCamelCase__							: int							):






										'''simple docstring'''






										if weight not in (0, 1):
															raise ValueError("""Edge weight must be either 0 or 1."""							)

										if to_vertex < 0 or to_vertex >= self.size:
															raise ValueError("""Vertex indexes must be in [0; size)."""							)

										self._graph[from_vertex].append(Edge(__UpperCAmelCase				,       __UpperCAmelCase							)							)







					def 	UpperCAmelCase__							(  self							: Any				,       UpperCamelCase__							: int				,       UpperCamelCase__							: int							):






										'''simple docstring'''






										lowercase_					=      deque([start_vertex]							)
										lowercase_					=      [None] * self.size
										lowercase_					=      0

										while queue:
															lowercase_					=      queue.popleft()
															lowercase_					=      distances[current_vertex]
															if current_distance is None:
																				continue

															for edge in self[current_vertex]:
																				lowercase_					=      current_distance + edge.weight
																				lowercase_					=      distances[edge.destination_vertex]
																				if (
																				    isinstance(__UpperCAmelCase				,       __UpperCAmelCase							)
																				    and new_distance >= dest_vertex_distance
																				):
																									continue
																				lowercase_					=      new_distance
																				if edge.weight == 0:
																									queue.appendleft(edge.destination_vertex							)
																				else:
																									queue.append(edge.destination_vertex							)

										if distances[finish_vertex] is None:
															raise ValueError("""No path from start_vertex to finish_vertex."""							)

										return distances[finish_vertex]


if __name__ == "__main__":
							import doctest

							doctest.testmod()










UpperCAmelCase__      			=						'''Input must be a string of 8 numbers plus letter'''
UpperCAmelCase__      			=						'''TRWAGMYFPDXBNJZSQVHLCKE'''







def     a_   (__A      )				->						bool:



					"""simple docstring"""

					if not isinstance(__A				,       __A      ):
										__a					:						Any      =					f'Expected string as input, found {type(__A      ).__name__}'
										raise TypeError(__A      )

					__a					:						int      =					spanish_id.replace("-"				,       ""      ).upper()
					if len(__A      ) != 9:
										raise ValueError(__A      )

					try:
										__a					:						Tuple      =					int(spanish_id_clean[0:8]      )
										__a					:						Optional[int]      =					spanish_id_clean[8]
					except ValueError as ex:
										raise ValueError(__A      ) from ex

					if letter.isdigit():
										raise ValueError(__A      )

					return letter == LOOKUP_LETTERS[number % 23]


if __name__ == "__main__":
			import doctest

			doctest.testmod()





