


def 	_lowerCAmelCase  (							lowerCAmelCase_							:list[list[int]]							)->bool:
   '''simple docstring'''






   snake_case_         =   [list(lowerCAmelCase_							) for row in matrix]
   if matrix and isinstance(lowerCAmelCase_						,  lowerCAmelCase_							):
      if isinstance(matrix[0]						,  lowerCAmelCase_							):
         snake_case_         =   0
         for row in matrix:
            if prev_len == 0:
               snake_case_         =   len(lowerCAmelCase_							)
               snake_case_         =   True
            else:
               snake_case_         =   prev_len == len(lowerCAmelCase_							)
      else:
         snake_case_         =   True
   else:
      snake_case_         =   False

   return result



def 	_lowerCAmelCase  (							lowerCAmelCase_							:list[list[int]]							)->None:
   '''simple docstring'''






   if check_matrix(lowerCAmelCase_							) and len(lowerCAmelCase_							) > 0:
      snake_case_         =   [list(lowerCAmelCase_							) for row in a]
      snake_case_         =   len(lowerCAmelCase_							)
      if isinstance(a[0]						,  lowerCAmelCase_							):
         snake_case_         =   len(a[0]							)
      else:
         for dat in a:
            print(lowerCAmelCase_							)
         return

      # horizotal printing increasing
      for i in range(0						,  lowerCAmelCase_							):
         print(a[0][i]							)
      # vertical printing down
      for i in range(1						,  lowerCAmelCase_							):
         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]							)
      snake_case_         =   [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
      if len(lowerCAmelCase_							) > 0:
         spiral_print_clockwise(lowerCAmelCase_							)
      else:
         return
   else:
      print("Not a valid matrix"							)
      return



def 	_lowerCAmelCase  (							lowerCAmelCase_							:list[list]							)->list[int]:
   '''simple docstring'''






   if matrix:
      return list(matrix.pop(0							)							) + spiral_traversal(list(zip(*lowerCAmelCase_							)							)[::-1]							)
   else:
      return []


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

   doctest.testmod()

   SCREAMING_SNAKE_CASE		:int											=       [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
   spiral_print_clockwise(a)








from __future__ import annotations



def      _lowerCAmelCase  (							lowerCAmelCase_							:int							)->list[int]:
   '''simple docstring'''






   assert (
       isinstance(lowerCAmelCase_						,  lowerCAmelCase_							) and mask > 0
   ), F'''mask needs to be positive integer, your input {mask}'''
   snake_case_         =   []
   snake_case_         =   mask

   while submask:
      all_submasks.append(lowerCAmelCase_							)
      snake_case_         =   (submask - 1) & mask

   return all_submasks


if __name__ == "__main__":
   import doctest

   doctest.testmod()




