
from collections import deque



def   __lowerCAmelCase    (				UpperCAmelCase__					:   Tuple							)	->     Any:
							lowerCamelCase_					=       len(UpperCAmelCase__							)
							lowerCamelCase_					=       deque()
							lowerCamelCase_					=       [False for _ in range(UpperCAmelCase__							)]
							lowerCamelCase_					=       [-1 for _ in range(UpperCAmelCase__							)]
							lowerCamelCase_					=       index_of[:]

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

														for w in g[v]:
																					if index_of[w] == -1:
																												lowerCamelCase_					=       strong_connect(UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__							)
																												lowerCamelCase_					=       (
																												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																												)
																					elif on_stack[w]:
																												lowerCamelCase_					=       (
																												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																												)

														if lowlink_of[v] == index_of[v]:
																					lowerCamelCase_					=       []
																					lowerCamelCase_					=       stack.pop()
																					lowerCamelCase_					=       False
																					component.append(UpperCAmelCase__							)
																					while w != v:
																												lowerCamelCase_					=       stack.pop()
																												lowerCamelCase_					=       False
																												component.append(UpperCAmelCase__							)
																					components.append(UpperCAmelCase__							)
														return index

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

							return components



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


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

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







import importlib.metadata
import operator
import re
import sys
from typing import Optional

from packaging import version


lowercase   =	{
    '''<''': operator.lt,
    '''<=''': operator.le,
    '''==''': operator.eq,
    '''!=''': operator.ne,
    '''>=''': operator.ge,
    '''>''': operator.gt,
}



def   __lowerCAmelCase    (				UpperCAmelCase__					:   Tuple      ,					UpperCAmelCase__					:   int      ,					UpperCAmelCase__					:   Optional[int]      ,					UpperCAmelCase__					:   Optional[int]      ,					UpperCAmelCase__					:   Optional[int]      ,					UpperCAmelCase__					:   int							)	->     Union[str, Any]:
							if got_ver is None or want_ver is None:
														raise ValueError(
														    F'''Unable to compare versions for {requirement}: need={want_ver} found={got_ver}. This is unusual. Consider'''
														    F''' reinstalling {pkg}.'''							)
							if not ops[op](version.parse(UpperCAmelCase__							)      ,					version.parse(UpperCAmelCase__							)							):
														raise ImportError(
														    F'''{requirement} is required for a normal functioning of this module, but found {pkg}=={got_ver}.{hint}'''							)



def   __lowerCAmelCase    (				UpperCAmelCase__					:   str      ,					UpperCAmelCase__					:   Optional[str] = None							)	->     None:
							lowerCamelCase_					=       F'''\n{hint}''' if hint is not None else """"""

							# non-versioned check
							if re.match(R"""^[\w_\-\d]+$"""      ,					UpperCAmelCase__							):
														lowerCamelCase_	, lowerCamelCase_	, lowerCamelCase_					=       requirement, None, None
							else:
														lowerCamelCase_					=       re.findall(R"""^([^!=<>\s]+)([\s!=<>]{1,2}.+)"""      ,					UpperCAmelCase__							)
														if not match:
																					raise ValueError(
																					    """requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23, but"""
																					    F''' got {requirement}'''							)
														lowerCamelCase_	, lowerCamelCase_					=       match[0]
														lowerCamelCase_					=       want_full.split(""","""							)  # there could be multiple requirements
														lowerCamelCase_					=       {}
														for w in want_range:
																					lowerCamelCase_					=       re.findall(R"""^([\s!=<>]{1,2})(.+)"""      ,					UpperCAmelCase__							)
																					if not match:
																												raise ValueError(
																												    """requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23,"""
																												    F''' but got {requirement}'''							)
																					lowerCamelCase_	, lowerCamelCase_					=       match[0]
																					lowerCamelCase_					=       want_ver
																					if op not in ops:
																												raise ValueError(F'''{requirement}: need one of {list(ops.keys()							)}, but got {op}'''							)

    # special case
							if pkg == "python":
														lowerCamelCase_					=       """.""".join([str(UpperCAmelCase__							) for x in sys.version_info[:3]]							)
														for op, want_ver in wanted.items():
																					_compare_versions(UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__							)
														return

							# check if any version is installed
							try:
														lowerCamelCase_					=       importlib.metadata.version(UpperCAmelCase__							)
							except importlib.metadata.PackageNotFoundError:
														raise importlib.metadata.PackageNotFoundError(
														    F'''The \'{requirement}\' distribution was not found and is required by this application. {hint}'''							)

							# check that the right version is installed if version number or a range was provided
							if want_ver is not None:
														for op, want_ver in wanted.items():
																					_compare_versions(UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__      ,					UpperCAmelCase__							)



def   __lowerCAmelCase    (				UpperCAmelCase__					:   List[str]							)	->     Dict:
							lowerCamelCase_					=       """Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main"""
							return require_version(UpperCAmelCase__      ,					UpperCAmelCase__							)





