





from collections import deque


def 							SCREAMING_SNAKE_CASE__						(    __a   ):
	snake_case_		:			Dict											=	len(lowercase_   )
	snake_case_		:			str											=	deque()
	snake_case_		:			str											=	[False for _ in range(lowercase_   )]
	snake_case_		:			List[Any]											=	[-1 for _ in range(lowercase_   )]
	snake_case_		:			Any											=	index_of[:]

	def strong_connect(__a   , __a   , __a   ):
		snake_case_		:			List[Any]											=	index  # the number when this node is seen
		snake_case_		:			List[str]											=	index  # lowest rank node reachable from here
		index += 1
		stack.append(lowercase_   )
		snake_case_		:			int											=	True

		for w in g[v]:
			if index_of[w] == -1:
				snake_case_		:			int											=	strong_connect(lowercase_   , lowercase_   , lowercase_   )
				snake_case_		:			Dict											=	(
				    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
				)
			elif on_stack[w]:
				snake_case_		:			Any											=	(
				    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_		:			Dict											=	stack.pop()
			snake_case_		:			Dict											=	False
			component.append(lowercase_   )
			while w != v:
				snake_case_		:			List[str]											=	stack.pop()
				snake_case_		:			Tuple											=	False
				component.append(lowercase_   )
			components.append(lowercase_   )
		return index

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

	return components


def 							SCREAMING_SNAKE_CASE__						(    __a   , __a   ):
	snake_case_		:			List[Any]											=	[[] for _ in range(lowercase_   )]
	for u, v in edges:
		g[u].append(lowercase_   )
	return g


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

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








from __future__ import annotations

from dataclasses import dataclass
@dataclass
class SCREAMING_SNAKE_CASE_						:
						__magic_name__:			float
						__magic_name__:			TreeNode | None       =       None
						__magic_name__:			TreeNode | None       =       None


def 							SCREAMING_SNAKE_CASE__						(    __a   ):

	# Validation
	def is_valid_tree(__a   ) -> bool:
		if node is None:
			return True

		if not isinstance(__a   , __a   ):
			return False

		try:
			float(node.data   )
		except (TypeError, ValueError):
			return False

		return is_valid_tree(node.left   ) and is_valid_tree(node.right   )

	if not is_valid_tree(__a   ):
		raise ValueError(
		    'Each node should be type of TreeNode and data should be float.'   )

	def is_binary_search_tree_recursive_check(
	    __a   , __a   , __a   ) -> bool:

		if node is None:
			return True

		return (
		    left_bound < node.data < right_bound
		    and is_binary_search_tree_recursive_check(node.left   , __a   , node.data   )
		    and is_binary_search_tree_recursive_check(
		        node.right   , node.data   , __a   )
		)

	return is_binary_search_tree_recursive_check(__a   , -float('inf'   )   , float('inf'   )   )


if __name__ == "__main__":
						import doctest

						doctest.testmod()

