






"""simple docstring"""

from queue import PriorityQueue
from typing import Any

import numpy as np






def _lowerCAmelCase	(  __lowerCamelCase:int ,						__lowerCamelCase:Optional[Any] ,						__lowerCamelCase:int ,						__lowerCamelCase:Optional[int] ,						__lowerCamelCase:Union[str, Any] ,						__lowerCamelCase:List[Any] ,						__lowerCamelCase:List[Any] ,						__lowerCamelCase:Any ,						__lowerCamelCase:List[str] ,						):

						'''simple docstring'''






						for nxt, d in graph[v]:
												if nxt in visited_forward:
																		continue
												__magic_name__     :   str            =     cst_fwd.get(a__ ,						np.inf   )
												__magic_name__     :   int            =     cst_fwd[v] + d
												if new_cost_f < old_cost_f:
																		queue.put((new_cost_f, nxt)   )
																		__magic_name__     :   int            =     new_cost_f
																		__magic_name__     :   Union[str, Any]            =     v
												if nxt in visited_backward:
																		if cst_fwd[v] + d + cst_bwd[nxt] < shortest_distance:
																								__magic_name__     :   Tuple            =     cst_fwd[v] + d + cst_bwd[nxt]
						return shortest_distance






def _lowerCAmelCase	(  __lowerCamelCase:str ,						__lowerCamelCase:List[str] ,						__lowerCamelCase:Tuple ,						__lowerCamelCase:List[Any]   ):

						'''simple docstring'''






						__magic_name__     :   Union[str, Any]            =     -1

						__magic_name__     :   Optional[int]            =     set()
						__magic_name__     :   Optional[Any]            =     set()
						__magic_name__     :   Union[str, Any]            =     {source: 0}
						__magic_name__     :   Any            =     {destination: 0}
						__magic_name__     :   Tuple            =     {source: None}
						__magic_name__     :   List[str]            =     {destination: None}
						__magic_name__     :   Dict            =     PriorityQueue()
						__magic_name__     :   Tuple            =     PriorityQueue()

						__magic_name__     :   int            =     np.inf

						queue_forward.put((0, source)   )
						queue_backward.put((0, destination)   )

						if source == destination:
												return 0

						while not queue_forward.empty() and not queue_backward.empty():
												__magic_name__      ,    __magic_name__     :   Optional[Any]            =     queue_forward.get()
												visited_forward.add(a__   )

												__magic_name__      ,    __magic_name__     :   str            =     queue_backward.get()
												visited_backward.add(a__   )

												__magic_name__     :   Tuple            =     pass_and_relaxation(
												    a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						)

												__magic_name__     :   Tuple            =     pass_and_relaxation(
												    a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						a__ ,						)

												if cst_fwd[v_fwd] + cst_bwd[v_bwd] >= shortest_distance:
																		break

						if shortest_distance != np.inf:
												__magic_name__     :   List[str]            =     shortest_distance
						return shortest_path_distance


lowercase    			=       {
    '''B''': [['''C''', 1]],
    '''C''': [['''D''', 1]],
    '''D''': [['''F''', 1]],
    '''E''': [['''B''', 1], ['''G''', 2]],
    '''F''': [],
    '''G''': [['''F''', 1]],
}
lowercase    			=       {
    '''B''': [['''E''', 1]],
    '''C''': [['''B''', 1]],
    '''D''': [['''C''', 1]],
    '''F''': [['''D''', 1], ['''G''', 1]],
    '''E''': [[None, np.inf]],
    '''G''': [['''E''', 2]],
}

if __name__ == "__main__":
			import doctest

			doctest.testmod()











"""simple docstring"""

def _lowerCAmelCase	(  __lowerCamelCase:int   ):

						'''simple docstring'''






						__magic_name__            =     n ** (1 / 3)
						return (val * val * val) == n


if __name__ == "__main__":
			print(perfect_cube(27))
			print(perfect_cube(4))



