






"""simple docstring"""



from collections import deque




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Optional[int] )						->Optional[int]:
						A__  :					List[str]											=					len(UpperCAmelCase__ )
						A__  :					List[str]											=					deque()
						A__  :					List[str]											=					[False for _ in range(UpperCAmelCase__ )]
						A__  :					List[Any]											=					[-1 for _ in range(UpperCAmelCase__ )]
						A__  :					Any											=					index_of[:]

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

												for w in g[v]:
																		if index_of[w] == -1:
																								A__  :					Any											=					strong_connect(UpperCAmelCase__,  UpperCAmelCase__,  UpperCAmelCase__ )
																								A__  :					Optional[Any]											=					(
																								    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																								)
																		elif on_stack[w]:
																								A__  :					Union[str, Any]											=					(
																								    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																								)

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

						A__  :					Optional[Any]											=					[]
						for v in range(UpperCAmelCase__ ):
												if index_of[v] == -1:
																		strong_connect(UpperCAmelCase__,  0,  UpperCAmelCase__ )

						return components




def        _lowerCAmelCase						(							UpperCAmelCase__    :   List[Any],  UpperCAmelCase__    :   Any )						->List[str]:
						A__  :					str											=					[[] for _ in range(UpperCAmelCase__ )]
						for u, v in edges:
												g[u].append(UpperCAmelCase__ )
						return g


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

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














"""simple docstring"""



import os
from distutils.util import strtobool




def        _lowerCAmelCase						(							UpperCAmelCase__    :   List[Any],  UpperCAmelCase__    :   Optional[Any] )						->List[str]:
						for e in env_keys:
												A__  :					List[Any]											=					int(os.environ.get(UpperCAmelCase__,  -1 ) )
												if val >= 0:
																		return val
						return default




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Tuple,  UpperCAmelCase__    :   str=False )						->List[str]:
						A__  :					List[Any]											=					os.environ.get(UpperCAmelCase__,  str(UpperCAmelCase__ ) )
						return strtobool(UpperCAmelCase__ ) == 1  # As its name indicates `strtobool` actually returns an int...




def        _lowerCAmelCase						(							UpperCAmelCase__    :   Tuple,  UpperCAmelCase__    :   List[Any]="no" )						->int:
						A__  :					str											=					os.environ.get(UpperCAmelCase__,  str(UpperCAmelCase__ ) )
						return value






