


def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__						):
 # must be
 __lowerCamelCase		:							Optional[int]							=						[list(SCREAMING_SNAKE_CASE__						) for row in matrix]
 if matrix and isinstance(SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__						):
  if isinstance(matrix[0]			,       SCREAMING_SNAKE_CASE__						):
   __lowerCamelCase		:							List[Any]							=						0
   for row in matrix:
    if prev_len == 0:
     __lowerCamelCase		:							Optional[int]							=						len(SCREAMING_SNAKE_CASE__						)
     __lowerCamelCase		:							Union[str, Any]							=						True
    else:
     __lowerCamelCase		:							Optional[int]							=						prev_len == len(SCREAMING_SNAKE_CASE__						)
  else:
   __lowerCamelCase		:							Dict							=						True
 else:
  __lowerCamelCase		:							List[Any]							=						False

 return result
def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__						):
 if check_matrix(SCREAMING_SNAKE_CASE__						) and len(SCREAMING_SNAKE_CASE__						) > 0:
  __lowerCamelCase		:							List[str]							=						[list(SCREAMING_SNAKE_CASE__						) for row in a]
  __lowerCamelCase		:							str							=						len(SCREAMING_SNAKE_CASE__						)
  if isinstance(a[0]			,       SCREAMING_SNAKE_CASE__						):
   __lowerCamelCase		:							int							=						len(a[0]						)
  else:
   for dat in a:
    print(SCREAMING_SNAKE_CASE__						)
   return

  # horizotal printing increasing
  for i in range(0			,       SCREAMING_SNAKE_CASE__						):
   print(a[0][i]						)
  # vertical printing down
  for i in range(1			,       SCREAMING_SNAKE_CASE__						):
   print(a[i][mat_col - 1]						)
  # horizotal printing decreasing
  if mat_row > 1:
   for i in range(mat_col - 2			,       -1			,       -1						):
    print(a[mat_row - 1][i]						)
        # vertical printing up
  for i in range(mat_row - 2			,       0			,       -1						):
   print(a[i][0]						)
  __lowerCamelCase		:							Optional[Any]							=						[row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
  if len(SCREAMING_SNAKE_CASE__						) > 0:
   spiral_print_clockwise(SCREAMING_SNAKE_CASE__						)
  else:
   return
 else:
  print('Not a valid matrix'						)
  return
def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__						):
 if matrix:
  return list(matrix.pop(0						)						) + spiral_traversal(list(zip(*SCREAMING_SNAKE_CASE__						)						)[::-1]						)
 else:
  return []


# driver code
if __name__ == "__main__":
       import doctest

       doctest.testmod()

       lowercase_           =	[[1, 2, 3, 4], [5, 6, 7, 8], [9, 1_0, 1_1, 1_2]]
       spiral_print_clockwise(a)





from __future__ import annotations
def       UpperCamelCase__     (  SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase					,     __lowerCamelCase		:							str							=						m - 1, 0
 while i >= 0 and j < n:
  if key == mat[i][j]:
   print(f'Key {key} found at row- {i + 1} column- {j + 1}'						)
   return
  if key < mat[i][j]:
   i -= 1
  else:
   j += 1
 print(f'Key {key} not found'						)
def       UpperCamelCase__     (  ):
 __lowerCamelCase		:							List[Any]							=						[[2, 5, 7], [4, 8, 13], [9, 11, 15], [12, 17, 20]]
 __lowerCamelCase		:							int							=						int(input('Enter the element to be searched:'						)						)
 print(SCREAMING_SNAKE_CASE__						)
 search_in_a_sorted_matrix(SCREAMING_SNAKE_CASE__			,       len(SCREAMING_SNAKE_CASE__						)			,       len(mat[0]						)			,       SCREAMING_SNAKE_CASE__						)


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       main()

