'''simple docstring'''

from collections import deque







def      UpperCamelCase_						(					snake_case_       :       List[str]      )					->     Any:






 '''simple docstring'''

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

 def strong_connect(snake_case_       :       Tuple						,		snake_case_       :       int						,		snake_case_       :       Union[str, Any]      ):
  __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      UpperCamelCase_						(					snake_case_       :       int						,		snake_case_       :       int      )					->     str:






 '''simple docstring'''

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


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

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













"""simple docstring"""




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCamelCase_     :						List[str]						=					{'configuration_xlnet': ['XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLNetConfig']}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase_     :						str						=					['XLNetTokenizer']

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase_     :						List[str]						=					['XLNetTokenizerFast']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase_     :						int						=					[
       'XLNET_PRETRAINED_MODEL_ARCHIVE_LIST',
       'XLNetForMultipleChoice',
       'XLNetForQuestionAnswering',
       'XLNetForQuestionAnsweringSimple',
       'XLNetForSequenceClassification',
       'XLNetForTokenClassification',
       'XLNetLMHeadModel',
       'XLNetModel',
       'XLNetPreTrainedModel',
       'load_tf_weights_in_xlnet',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase_     :						Union[str, Any]						=					[
       'TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST',
       'TFXLNetForMultipleChoice',
       'TFXLNetForQuestionAnsweringSimple',
       'TFXLNetForSequenceClassification',
       'TFXLNetForTokenClassification',
       'TFXLNetLMHeadModel',
       'TFXLNetMainLayer',
       'TFXLNetModel',
       'TFXLNetPreTrainedModel',
   ]


if TYPE_CHECKING:
   from .configuration_xlnet import XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP, XLNetConfig

   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_xlnet import XLNetTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_xlnet_fast import XLNetTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_xlnet import (
          XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
          XLNetForMultipleChoice,
          XLNetForQuestionAnswering,
          XLNetForQuestionAnsweringSimple,
          XLNetForSequenceClassification,
          XLNetForTokenClassification,
          XLNetLMHeadModel,
          XLNetModel,
          XLNetPreTrainedModel,
          load_tf_weights_in_xlnet,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_xlnet import (
          TF_XLNET_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFXLNetForMultipleChoice,
          TFXLNetForQuestionAnsweringSimple,
          TFXLNetForSequenceClassification,
          TFXLNetForTokenClassification,
          TFXLNetLMHeadModel,
          TFXLNetMainLayer,
          TFXLNetModel,
          TFXLNetPreTrainedModel,
      )

else:
   import sys

   lowerCamelCase_     :						List[Any]						=					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)