


from collections import deque
def 				UpperCAmelCase_					(							__snake_case						)     ->			List[Any]:







 """simple docstring"""


 _lowercase							      =len(__snake_case						)
 _lowercase							      =deque()
 _lowercase							      =[False for _ in range(__snake_case						)]
 _lowercase							      =[-1 for _ in range(__snake_case						)]
 _lowercase							      =index_of[:]

 def strong_connect(__snake_case     ,						__snake_case     ,						__snake_case						):
  _lowercase							      =index  # the number when this node is seen
  _lowercase							      =index  # lowest rank node reachable from here
  index += 1
  stack.append(__snake_case						)
  _lowercase							      =True

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

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

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

 return components
def 				UpperCAmelCase_					(							__snake_case     ,						__snake_case						)     ->			Optional[int]:







 """simple docstring"""


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


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

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





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


UpperCAmelCase__   	=							{
    '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''],
    '''tokenization_xlm''': ['''XLMTokenizer'''],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__   	=							[
      '''XLM_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''XLMForMultipleChoice''',
      '''XLMForQuestionAnswering''',
      '''XLMForQuestionAnsweringSimple''',
      '''XLMForSequenceClassification''',
      '''XLMForTokenClassification''',
      '''XLMModel''',
      '''XLMPreTrainedModel''',
      '''XLMWithLMHeadModel''',
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__   	=							[
      '''TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''TFXLMForMultipleChoice''',
      '''TFXLMForQuestionAnsweringSimple''',
      '''TFXLMForSequenceClassification''',
      '''TFXLMForTokenClassification''',
      '''TFXLMMainLayer''',
      '''TFXLMModel''',
      '''TFXLMPreTrainedModel''',
      '''TFXLMWithLMHeadModel''',
  ]


if TYPE_CHECKING:
  from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
  from .tokenization_xlm import XLMTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_xlm import (
        XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        XLMForMultipleChoice,
        XLMForQuestionAnswering,
        XLMForQuestionAnsweringSimple,
        XLMForSequenceClassification,
        XLMForTokenClassification,
        XLMModel,
        XLMPreTrainedModel,
        XLMWithLMHeadModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_xlm import (
        TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFXLMForMultipleChoice,
        TFXLMForQuestionAnsweringSimple,
        TFXLMForSequenceClassification,
        TFXLMForTokenClassification,
        TFXLMMainLayer,
        TFXLMModel,
        TFXLMPreTrainedModel,
        TFXLMWithLMHeadModel,
    )

else:
  import sys

  UpperCAmelCase__   	=							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

