import heapq as hq
import math
from collections.abc import Iterator





class 					lowercase__						:


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





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:    int							=							str(id_						)
												SCREAMING_SNAKE_CASE							:    Optional[Any]							=							None
												SCREAMING_SNAKE_CASE							:    Optional[int]							=							None
												SCREAMING_SNAKE_CASE							:    Optional[Any]							=							[]
												SCREAMING_SNAKE_CASE							:    Any							=							{}  # {vertex:distance}


						def __lt__(       self	:				Dict    ,		UpperCamelCase__	:				Any						):





												'''simple docstring'''





												return self.key < other.key


						def __repr__(       self	:				List[Any]						):





												'''simple docstring'''





												return self.id


						def        __A       (       self	:				Optional[int]    ,		UpperCamelCase__	:				Tuple						):





												'''simple docstring'''





												self.neighbors.append(__UpperCamelCase						)



						def        __A       (       self	:				str    ,		UpperCamelCase__	:				int    ,		UpperCamelCase__	:				Union[str, Any]						):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:    Optional[int]							=							weight






def       A	(    _lowercase		,  _lowercase		,  _lowercase		,  _lowercase						):
						# add the neighbors:
						graph[a - 1].add_neighbor(graph[b - 1]						)
						graph[b - 1].add_neighbor(graph[a - 1]						)
						# add the edges:
						graph[a - 1].add_edge(graph[b - 1]		,  _lowercase						)
						graph[b - 1].add_edge(graph[a - 1]		,  _lowercase						)
def       A	(    _lowercase		,  _lowercase						):
						SCREAMING_SNAKE_CASE							:    int							=							[]
						for u in graph:
												SCREAMING_SNAKE_CASE							:    Tuple							=							math.inf
												SCREAMING_SNAKE_CASE							:    int							=							None
						SCREAMING_SNAKE_CASE							:    List[Any]							=							0
						SCREAMING_SNAKE_CASE							:    List[str]							=							graph[:]
						while q:
												SCREAMING_SNAKE_CASE							:    Dict							=							min(_lowercase						)
												q.remove(_lowercase						)
												for v in u.neighbors:
																		if (v in q) and (u.edges[v.id] < v.key):
																								SCREAMING_SNAKE_CASE							:    Optional[Any]							=							u
																								SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							u.edges[v.id]
						for i in range(1		,  len(_lowercase						)						):
												a.append((int(graph[i].id						) + 1, int(graph[i].pi.id						) + 1)						)
						return a
def       A	(    _lowercase		,  _lowercase						):
						for u in graph:
												SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							math.inf
												SCREAMING_SNAKE_CASE							:    List[str]							=							None
						SCREAMING_SNAKE_CASE							:    List[Any]							=							0

						SCREAMING_SNAKE_CASE							:    str							=							list(_lowercase						)
						hq.heapify(_lowercase						)

						while h:
												SCREAMING_SNAKE_CASE							:    List[Any]							=							hq.heappop(_lowercase						)
												for v in u.neighbors:
																		if (v in h) and (u.edges[v.id] < v.key):
																								SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							u
																								SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							u.edges[v.id]
																								hq.heapify(_lowercase						)

						for i in range(1		,  len(_lowercase						)						):
												yield (int(graph[i].id						) + 1, int(graph[i].pi.id						) + 1)
def       A	(    ):
						pass


if __name__ == "__main__":
					import doctest

					doctest.testmod()












"""simple docstring"""
def 					A__				(			UpperCamelCase					,  UpperCamelCase = False       ):

							if not isinstance(UpperCamelCase					,  UpperCamelCase       ):
														A		=  F"Expected string as input, found {type(UpperCamelCase       )}"
														raise ValueError(UpperCamelCase       )
							if not isinstance(UpperCamelCase					,  UpperCamelCase       ):
														A		=  F"Expected boolean as use_pascal parameter, found {type(UpperCamelCase       )}"
														raise ValueError(UpperCamelCase       )

							A		=  input_str.split("_"       )

							A		=  0 if use_pascal else 1

							A		=  words[start_index:]

							A		=  [word[0].upper() + word[1:] for word in words_to_capitalize]

							A		=  "" if use_pascal else words[0]

							return "".join([initial_word, *capitalized_words]       )


if __name__ == "__main__":
		from doctest import testmod

		testmod()


