

'''simple docstring'''



from collections import deque
def 						__lowerCamelCase	(       __snake_case					:		Optional[int]	)	->							Tuple:






      """simple docstring"""





      A__					:       Optional[int]     =len(__snake_case	)
      A__					:       str     =deque()
      A__					:       Dict     =[False for _ in range(__snake_case	)]
      A__					:       Union[str, Any]     =[-1 for _ in range(__snake_case	)]
      A__					:       Tuple     =index_of[:]

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

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

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

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

      return components
def 						__lowerCamelCase	(       __snake_case					:		Tuple,		__snake_case					:		List[Any]	)	->							Any:






      """simple docstring"""





      A__					:       int     =[[] for _ in range(__snake_case	)]
      for u, v in edges:
            g[u].append(__snake_case	)
      return g


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

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




'''simple docstring'''



from __future__ import annotations
def 						__lowerCamelCase	(       __snake_case					:		list[int]	)	->							bool:






						"""simple docstring"""





						return len(set(__snake_case	)	) == len(__snake_case	)


if __name__ == "__main__":
		import doctest

		doctest.testmod()

