"""simple docstring"""







from collections import deque
def   __UpperCAmelCase    (   UpperCAmelCase_   :    Any  )							->      Tuple:

	'''simple docstring'''





	__snake_case      :							Optional[Any]						=			len(UpperCAmelCase_  )
	__snake_case      :							List[Any]						=			deque()
	__snake_case      :							int						=			[False for _ in range(UpperCAmelCase_  )]
	__snake_case      :							List[Any]						=			[-1 for _ in range(UpperCAmelCase_  )]
	__snake_case      :							Tuple						=			index_of[:]

	def strong_connect(UpperCAmelCase_   :    Any      ,							UpperCAmelCase_   :    Optional[int]      ,							UpperCAmelCase_   :    Any  ):
		__snake_case      :							Any						=			index  # the number when this node is seen
		__snake_case      :							Tuple						=			index  # lowest rank node reachable from here
		index += 1
		stack.append(UpperCAmelCase_  )
		__snake_case      :							int						=			True

		for w in g[v]:
			if index_of[w] == -1:
				__snake_case      :							List[Any]						=			strong_connect(UpperCAmelCase_      ,							UpperCAmelCase_      ,							UpperCAmelCase_  )
				__snake_case      :							Dict						=			(
				    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
				)
			elif on_stack[w]:
				__snake_case      :							str						=			(
				    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
				)

		if lowlink_of[v] == index_of[v]:
			__snake_case      :							str						=			[]
			__snake_case      :							str						=			stack.pop()
			__snake_case      :							int						=			False
			component.append(UpperCAmelCase_  )
			while w != v:
				__snake_case      :							List[str]						=			stack.pop()
				__snake_case      :							Union[str, Any]						=			False
				component.append(UpperCAmelCase_  )
			components.append(UpperCAmelCase_  )
		return index

	__snake_case      :							Tuple						=			[]
	for v in range(UpperCAmelCase_  ):
		if index_of[v] == -1:
			strong_connect(UpperCAmelCase_      ,							0      ,							UpperCAmelCase_  )

	return components
def   __UpperCAmelCase    (   UpperCAmelCase_   :    Union[str, Any]      ,							UpperCAmelCase_   :    Tuple  )							->      Optional[Any]:

	'''simple docstring'''





	__snake_case      :							Union[str, Any]						=			[[] for _ in range(UpperCAmelCase_  )]
	for u, v in edges:
		g[u].append(UpperCAmelCase_  )
	return g


if __name__ == "__main__":
	# Test
	_a					:					Any=			7
	_a					:					Tuple=			[0, 0, 1, 2, 3, 3, 4, 4, 6]
	_a					:					str=			[1, 3, 2, 0, 1, 4, 5, 6, 5]
	_a					:					Optional[int]=			[(u, v) for u, v in zip(source, target)]
	_a					:					str=			create_graph(n_vertices, edges)

	assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)






"""simple docstring"""







from __future__ import annotations

from math import pow, sqrt
def   __UpperCAmelCase    (   UpperCAmelCase_   :    float      ,							UpperCAmelCase_   :    float      ,							UpperCAmelCase_   :    float  )							->      dict[str, float]:

	'''simple docstring'''





	if (resistance, reactance, impedance).count(0  ) != 1:
		raise ValueError('One and only one argument must be 0'  )
	if resistance == 0:
		return {"resistance": sqrt(pow(UpperCAmelCase_      ,							2  ) - pow(UpperCAmelCase_      ,							2  )  )}
	elif reactance == 0:
		return {"reactance": sqrt(pow(UpperCAmelCase_      ,							2  ) - pow(UpperCAmelCase_      ,							2  )  )}
	elif impedance == 0:
		return {"impedance": sqrt(pow(UpperCAmelCase_      ,							2  ) + pow(UpperCAmelCase_      ,							2  )  )}
	else:
		raise ValueError('Exactly one argument must be 0'  )


if __name__ == "__main__":
	import doctest

	doctest.testmod()





