

'''simple docstring'''





from typing import TYPE_CHECKING

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


UpperCamelCase_							=					{"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FNetConfig"""]}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase_							=					["""FNetTokenizer"""]

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase_							=					["""FNetTokenizerFast"""]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase_							=					[
							    """FNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """FNetForMaskedLM""",
							    """FNetForMultipleChoice""",
							    """FNetForNextSentencePrediction""",
							    """FNetForPreTraining""",
							    """FNetForQuestionAnswering""",
							    """FNetForSequenceClassification""",
							    """FNetForTokenClassification""",
							    """FNetLayer""",
							    """FNetModel""",
							    """FNetPreTrainedModel""",
							]


if TYPE_CHECKING:
							from .configuration_fnet import FNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FNetConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_fnet import FNetTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_fnet_fast import FNetTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_fnet import (
														    FNET_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FNetForMaskedLM,
														    FNetForMultipleChoice,
														    FNetForNextSentencePrediction,
														    FNetForPreTraining,
														    FNetForQuestionAnswering,
														    FNetForSequenceClassification,
														    FNetForTokenClassification,
														    FNetLayer,
														    FNetModel,
														    FNetPreTrainedModel,
														)


else:
							import sys

							UpperCamelCase_							=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)








'''simple docstring'''





from __future__ import annotations






def 							_lowerCAmelCase (      __magic_name__	:    list[list[int]]	)							->     bool:
						lowercase   :       str								=len(__magic_name__	)
						# We need to create solution object to save path.
						lowercase   :       int								=[[0 for _ in range(__magic_name__	)] for _ in range(__magic_name__	)]
						lowercase   :       List[Any]								=run_maze(__magic_name__      ,   0      ,   0      ,   __magic_name__	)
						if solved:
												print('''\n'''.join(str(__magic_name__	) for row in solutions	)	)
						else:
												print('''No solution exists!'''	)
						return solved






def 							_lowerCAmelCase (      __magic_name__	:    list[list[int]]      ,   __magic_name__	:    int      ,   __magic_name__	:    int      ,   __magic_name__	:    list[list[int]]	)							->     bool:
						lowercase   :       Optional[int]								=len(__magic_name__	)
						# Final check point.
						if i == j == (size - 1):
												lowercase   :       Optional[int]								=1
												return True

						lowercase   :       Optional[int]								=(not i < 0) and (not j < 0)  # Check lower bounds
						lowercase   :       Tuple								=(i < size) and (j < size)  # Check upper bounds

						if lower_flag and upper_flag:
												# check for already visited and block points.
												lowercase   :       Union[str, Any]								=(not solutions[i][j]) and (not maze[i][j])
												if block_flag:
																		# check visited
																		lowercase   :       Union[str, Any]								=1

																		# check for directions
																		if (
																		    run_maze(__magic_name__      ,   i + 1      ,   __magic_name__      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   __magic_name__      ,   j + 1      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   i - 1      ,   __magic_name__      ,   __magic_name__	)
																		    or run_maze(__magic_name__      ,   __magic_name__      ,   j - 1      ,   __magic_name__	)
																		):
																								return True

																		lowercase   :       str								=0
																		return False
						return False


if __name__ == "__main__":
							import doctest

							doctest.testmod()





