
"""simple docstring"""







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







class 							__magic_name__     :

					'''simple docstring'''





					def __init__(				self   :							Tuple							,						snake_case_   :							Any    ):
												__snake_case     			=       str(id_    )
												__snake_case     			=       None
												__snake_case     			=       None
												__snake_case     			=       []
												__snake_case     			=       {}  # {vertex:distance}





					def __lt__(				self   :							int							,						snake_case_   :							List[Any]    ):
												return self.key < other.key





					def __repr__(				self   :							List[str]    ):
												return self.id





					def 							lowerCAmelCase      (				self   :							List[str]							,						snake_case_   :							Optional[int]    ):
												self.neighbors.append(__A    )





					def 							lowerCAmelCase      (				self   :							Optional[int]							,						snake_case_   :							Optional[int]							,						snake_case_   :							int    ):
												__snake_case     			=       weight




def   __UpperCamelCase   (					SCREAMING_SNAKE_CASE							,    SCREAMING_SNAKE_CASE							,    SCREAMING_SNAKE_CASE							,    SCREAMING_SNAKE_CASE )  ->     Optional[Any]:







							"""simple docstring"""


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







							"""simple docstring"""


							__snake_case     			=       []
							for u in graph:
														__snake_case     			=       math.inf
														__snake_case     			=       None
							__snake_case     			=       0
							__snake_case     			=       graph[:]
							while q:
														__snake_case     			=       min(_lowerCAmelCase )
														q.remove(_lowerCAmelCase )
														for v in u.neighbors:
																					if (v in q) and (u.edges[v.id] < v.key):
																												__snake_case     			=       u
																												__snake_case     			=       u.edges[v.id]
							for i in range(1							,    len(_lowerCAmelCase ) ):
														a.append((int(graph[i].id ) + 1, int(graph[i].pi.id ) + 1) )
							return a
def   __UpperCamelCase   (					SCREAMING_SNAKE_CASE							,    SCREAMING_SNAKE_CASE )  ->     int:







							"""simple docstring"""


							for u in graph:
														__snake_case     			=       math.inf
														__snake_case     			=       None
							__snake_case     			=       0

							__snake_case     			=       list(_lowerCAmelCase )
							hq.heapify(_lowerCAmelCase )

							while h:
														__snake_case     			=       hq.heappop(_lowerCAmelCase )
														for v in u.neighbors:
																					if (v in h) and (u.edges[v.id] < v.key):
																												__snake_case     			=       u
																												__snake_case     			=       u.edges[v.id]
																												hq.heapify(_lowerCAmelCase )

							for i in range(1							,    len(_lowerCAmelCase ) ):
														yield (int(graph[i].id ) + 1, int(graph[i].pi.id ) + 1)
def   __UpperCamelCase   (					)  ->     Optional[int]:







							"""simple docstring"""








if __name__ == "__main__":
		import doctest

		doctest.testmod()


"""simple docstring"""







from __future__ import annotations

from typing import Any
def   __UpperCamelCase   (					SCREAMING_SNAKE_CASE )  ->     int:







							"""simple docstring"""


							if not postfix_notation:
														return 0

							__snake_case     			=       {"+", "-", "*", "/"}
							__snake_case     			=       []

							for token in postfix_notation:
														if token in operations:
																					__snake_case			,   __snake_case     			=       stack.pop(), stack.pop()
																					if token == "+":
																												stack.append(a + b )
																					elif token == "-":
																												stack.append(a - b )
																					elif token == "*":
																												stack.append(a * b )
																					else:
																												if a * b < 0 and a % b != 0:
																																			stack.append(a // b + 1 )
																												else:
																																			stack.append(a // b )
														else:
																					stack.append(int(SCREAMING_SNAKE_CASE ) )

							return stack.pop()


if __name__ == "__main__":
		import doctest

		doctest.testmod()
