




def 					SCREAMING_SNAKE_CASE							(   __UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase)			->     Optional[int]:
     return len_board * len_board_column * row + column

def 					SCREAMING_SNAKE_CASE							(   __UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase		,					__UpperCamelCase		,					)			->     Optional[Any]:

     if board[row][column] != word[word_index]:
          return False

     if word_index == len(lowerCAmelCase_) - 1:
          return True

     a      =      [(0, 1), (0, -1), (-1, 0), (1, 0)]
     a      =      len(lowerCAmelCase_)
     a      =      len(board[0])
     for direction in traverts_directions:
          a      =      row + direction[0]
          a      =      column + direction[1]
          if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
               continue

          a      =      get_point_key(lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_)
          if key in visited_points_set:
               continue

          visited_points_set.add(lowerCAmelCase_)
          if exits_word(lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					word_index + 1		,					lowerCAmelCase_):
               return True

          visited_points_set.remove(lowerCAmelCase_)

     return False

def 					SCREAMING_SNAKE_CASE							(   __UpperCamelCase		,					__UpperCamelCase)			->     str:
     a      =      (
         """The board should be a non empty matrix of single chars strings."""
     )

     a      =      len(lowerCAmelCase_)
     if not isinstance(lowerCAmelCase_		,					lowerCAmelCase_) or len(lowerCAmelCase_) == 0:
          raise ValueError(lowerCAmelCase_)

     for row in board:
          if not isinstance(lowerCAmelCase_		,					lowerCAmelCase_) or len(lowerCAmelCase_) == 0:
               raise ValueError(lowerCAmelCase_)

          for item in row:
               if not isinstance(lowerCAmelCase_		,					lowerCAmelCase_) or len(lowerCAmelCase_) != 1:
                    raise ValueError(lowerCAmelCase_)

    # Validate word
     if not isinstance(lowerCAmelCase_		,					lowerCAmelCase_) or len(lowerCAmelCase_) == 0:
          raise ValueError(
              "The word parameter should be a string of length greater than 0.")

     a      =      len(board[0])
     for i in range(lowerCAmelCase_):
          for j in range(lowerCAmelCase_):
               if exits_word(
                   lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					0		,					{get_point_key(lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_		,					lowerCAmelCase_)}):
                    return True

     return False


if __name__ == "__main__":
   import doctest

   doctest.testmod()



'''simple docstring'''

from itertools import permutations







def __A  (    ):
     _UpperCAmelCase					:  Union[str, Any]         =    list(map("""""".join ,       permutations("""0123456789"""       )       )       )
     return result[99_9999]


if __name__ == "__main__":
   print(solution())


