
from collections import deque
def 							SCREAMING_SNAKE_CASE_	(					UpperCAmelCase_	:     List[Any]				)			->						Dict:
       SCREAMING_SNAKE_CASE_							:				Tuple		=len(__UpperCamelCase				)
       SCREAMING_SNAKE_CASE_							:				str		=deque()
       SCREAMING_SNAKE_CASE_							:				int		=[False for _ in range(__UpperCamelCase				)]
       SCREAMING_SNAKE_CASE_							:				List[str]		=[-1 for _ in range(__UpperCamelCase				)]
       SCREAMING_SNAKE_CASE_							:				str		=index_of[:]

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

              for w in g[v]:
                     if index_of[w] == -1:
                            SCREAMING_SNAKE_CASE_							:				Tuple		=strong_connect(__UpperCamelCase			,							__UpperCamelCase			,							__UpperCamelCase				)
                            SCREAMING_SNAKE_CASE_							:				int		=(
                                lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                            )
                     elif on_stack[w]:
                            SCREAMING_SNAKE_CASE_							:				str		=(
                                lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                            )

              if lowlink_of[v] == index_of[v]:
                     SCREAMING_SNAKE_CASE_							:				Dict		=[]
                     SCREAMING_SNAKE_CASE_							:				Dict		=stack.pop()
                     SCREAMING_SNAKE_CASE_							:				Optional[int]		=False
                     component.append(__UpperCamelCase				)
                     while w != v:
                            SCREAMING_SNAKE_CASE_							:				List[Any]		=stack.pop()
                            SCREAMING_SNAKE_CASE_							:				int		=False
                            component.append(__UpperCamelCase				)
                     components.append(__UpperCamelCase				)
              return index

       SCREAMING_SNAKE_CASE_							:				int		=[]
       for v in range(__UpperCamelCase				):
              if index_of[v] == -1:
                     strong_connect(__UpperCamelCase			,							0			,							__UpperCamelCase				)

       return components
def 							SCREAMING_SNAKE_CASE_	(					UpperCAmelCase_	:     List[str]			,							UpperCAmelCase_	:     str				)			->						int:
       SCREAMING_SNAKE_CASE_							:				Optional[Any]		=[[] 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)






'''simple docstring'''



def   lowercase__(			__UpperCamelCase:					int    ):

      """simple docstring"""






      if not isinstance(__UpperCamelCase      ,__UpperCamelCase    ):
            raise TypeError('Input value must be an \'int\' type'    )

      SCREAMING_SNAKE_CASE   :      int    					=						0
      while number:
            position += 1
            number >>= 1

      return position


if __name__ == "__main__":
      import doctest

      doctest.testmod()


