






'''simple docstring'''







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

class _lowercase	:




							def __init__(							self:				int			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	List[str]         =       str(id_     )
														lowerCamelCase__					:	Union[str, Any]         =       None
														lowerCamelCase__					:	Dict         =       None
														lowerCamelCase__					:	Optional[int]         =       []
														lowerCamelCase__					:	int         =       {}  # {vertex:distance}




							def __lt__(							self:				List[str]			,							UpperCamelCase__:				Dict     ):
														return self.key < other.key




							def __repr__(							self:				str     ):
														return self.id




							def 		lowerCamelCase_				(							self:				Any			,							UpperCamelCase__:				int     ):
														self.neighbors.append(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Union[str, Any]			,							UpperCamelCase__:				Optional[Any]			,							UpperCamelCase__:				Optional[int]     ):
														lowerCamelCase__					:	Any         =       weight





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase      )      ->       Union[str, Any]:
							# 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]				,			UpperCamelCase      )
							graph[b - 1].add_edge(graph[a - 1]				,			UpperCamelCase      )





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       list:
							lowerCamelCase__					:	List[Any]         =       []
							for u in graph:
														lowerCamelCase__					:	Optional[int]         =       math.inf
														lowerCamelCase__					:	List[str]         =       None
							lowerCamelCase__					:	List[str]         =       0
							lowerCamelCase__					:	Dict         =       graph[:]
							while q:
														lowerCamelCase__					:	Dict         =       min(UpperCamelCase      )
														q.remove(UpperCamelCase      )
														for v in u.neighbors:
																					if (v in q) and (u.edges[v.id] < v.key):
																												lowerCamelCase__					:	str         =       u
																												lowerCamelCase__					:	Dict         =       u.edges[v.id]
							for i in range(1				,			len(UpperCamelCase      )      ):
														a.append((int(graph[i].id      ) + 1, int(graph[i].pi.id      ) + 1)      )
							return a





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       Iterator[tuple]:
							for u in graph:
														lowerCamelCase__					:	Union[str, Any]         =       math.inf
														lowerCamelCase__					:	Tuple         =       None
							lowerCamelCase__					:	List[str]         =       0

							lowerCamelCase__					:	Optional[Any]         =       list(UpperCamelCase      )
							hq.heapify(UpperCamelCase      )

							while h:
														lowerCamelCase__					:	Dict         =       hq.heappop(UpperCamelCase      )
														for v in u.neighbors:
																					if (v in h) and (u.edges[v.id] < v.key):
																												lowerCamelCase__					:	int         =       u
																												lowerCamelCase__					:	Optional[int]         =       u.edges[v.id]
																												hq.heapify(UpperCamelCase      )

							for i in range(1				,			len(UpperCamelCase      )      ):
														yield (int(graph[i].id      ) + 1, int(graph[i].pi.id      ) + 1)





def  SCREAMING_SNAKE_CASE_       ()      ->       None:
							pass


if __name__ == "__main__":
			import doctest

			doctest.testmod()









'''simple docstring'''







from collections.abc import Sequence





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       float:
							return sum(c * (x**i) for i, c in enumerate(UpperCamelCase      )      )





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       float:
							lowerCamelCase__					:	str         =       0.0
							for coeff in reversed(UpperCamelCase      ):
														lowerCamelCase__					:	Optional[int]         =       result * x + coeff
							return result


if __name__ == "__main__":
			_A	:			Any         =(0.0, 0.0, 5.0, 9.3, 7.0)
			_A	:			Optional[Any]         =10.0
			print(evaluate_poly(poly, x))
			print(horner(poly, x))

