




from __future__ import annotations







def 	_a      (						SCREAMING_SNAKE_CASE_							:				list[list[int]]     ):
					__lowerCAmelCase				   =       len(SCREAMING_SNAKE_CASE_     )
					# We need to create solution object to save path.
					__lowerCAmelCase				   =       [[0 for _ in range(SCREAMING_SNAKE_CASE_     )] for _ in range(SCREAMING_SNAKE_CASE_     )]
					__lowerCAmelCase				   =       run_maze(SCREAMING_SNAKE_CASE_      ,      0      ,      0      ,      SCREAMING_SNAKE_CASE_     )
					if solved:
										print("\n".join(str(SCREAMING_SNAKE_CASE_     ) for row in solutions     )     )
					else:
										print("No solution exists!"     )
					return solved







def 	_a      (						SCREAMING_SNAKE_CASE_							:				list[list[int]]      ,      SCREAMING_SNAKE_CASE_							:				int      ,      SCREAMING_SNAKE_CASE_							:				int      ,      SCREAMING_SNAKE_CASE_							:				list[list[int]]     ):
					__lowerCAmelCase				   =       len(SCREAMING_SNAKE_CASE_     )
					# Final check point.
					if i == j == (size - 1):
										__lowerCAmelCase				   =       1
										return True

					__lowerCAmelCase				   =       (not i < 0) and (not j < 0)  # Check lower bounds
					__lowerCAmelCase				   =       (i < size) and (j < size)  # Check upper bounds

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

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

															__lowerCAmelCase				   =       0
															return False
					return False


if __name__ == "__main__":
					import doctest

					doctest.testmod()










from typing import TYPE_CHECKING

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


lowerCamelCase				:		Union[str, Any]     =   {
    "configuration_convbert": ["CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvBertConfig", "ConvBertOnnxConfig"],
    "tokenization_convbert": ["ConvBertTokenizer"],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase				:		Optional[Any]     =   ["ConvBertTokenizerFast"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase				:		Dict     =   [
     "CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
     "ConvBertForMaskedLM",
     "ConvBertForMultipleChoice",
     "ConvBertForQuestionAnswering",
     "ConvBertForSequenceClassification",
     "ConvBertForTokenClassification",
     "ConvBertLayer",
     "ConvBertModel",
     "ConvBertPreTrainedModel",
     "load_tf_weights_in_convbert",
 ]


try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase				:		Tuple     =   [
     "TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
     "TFConvBertForMaskedLM",
     "TFConvBertForMultipleChoice",
     "TFConvBertForQuestionAnswering",
     "TFConvBertForSequenceClassification",
     "TFConvBertForTokenClassification",
     "TFConvBertLayer",
     "TFConvBertModel",
     "TFConvBertPreTrainedModel",
 ]


if TYPE_CHECKING:
 from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
 from .tokenization_convbert import ConvBertTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_convbert_fast import ConvBertTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_convbert import (
      CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      ConvBertForMaskedLM,
      ConvBertForMultipleChoice,
      ConvBertForQuestionAnswering,
      ConvBertForSequenceClassification,
      ConvBertForTokenClassification,
      ConvBertLayer,
      ConvBertModel,
      ConvBertPreTrainedModel,
      load_tf_weights_in_convbert,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_convbert import (
      TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFConvBertForMaskedLM,
      TFConvBertForMultipleChoice,
      TFConvBertForQuestionAnswering,
      TFConvBertForSequenceClassification,
      TFConvBertForTokenClassification,
      TFConvBertLayer,
      TFConvBertModel,
      TFConvBertPreTrainedModel,
  )


else:
 import sys

 lowerCamelCase				:		Optional[int]     =   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



