
'''simple docstring'''
def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__       )   ->				bool:


		'''simple docstring'''


		snake_case   :    Optional[Any]			       =		[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__       ):
						snake_case   :    List[str]			       =		0
						for row in matrix:
								if prev_len == 0:
										snake_case   :    Optional[Any]			       =		len(SCREAMING_SNAKE_CASE__       )
										snake_case   :    int			       =		True
								else:
										snake_case   :    Any			       =		prev_len == len(SCREAMING_SNAKE_CASE__       )
				else:
						snake_case   :    List[str]			       =		True
		else:
				snake_case   :    Tuple			       =		False

		return result




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__       )   ->				None:


		'''simple docstring'''


		if check_matrix(SCREAMING_SNAKE_CASE__       ) and len(SCREAMING_SNAKE_CASE__       ) > 0:
				snake_case   :    Dict			       =		[list(SCREAMING_SNAKE_CASE__       ) for row in a]
				snake_case   :    int			       =		len(SCREAMING_SNAKE_CASE__       )
				if isinstance(a[0]      ,    SCREAMING_SNAKE_CASE__       ):
						snake_case   :    Any			       =		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]       )
				snake_case   :    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__       )   ->				list[int]:


		'''simple docstring'''


		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)




'''simple docstring'''
from __future__ import annotations

import sys




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__       )   ->				tuple[int, int]:


		'''simple docstring'''


		if abs(SCREAMING_SNAKE_CASE__       ) == 1:
				return a, 0
		elif abs(SCREAMING_SNAKE_CASE__       ) == 1:
				return 0, b

		snake_case       ,snake_case   :    Tuple			       =		a, b
		snake_case       ,snake_case   :    List[str]			       =		1, 0
		snake_case       ,snake_case   :    Optional[Any]			       =		0, 1

		while remainder != 0:
				snake_case   :    int			       =		old_remainder // remainder
				snake_case       ,snake_case   :    Tuple			       =		remainder, old_remainder - quotient * remainder
				snake_case       ,snake_case   :    Optional[Any]			       =		coeff_a, old_coeff_a - quotient * coeff_a
				snake_case       ,snake_case   :    Dict			       =		coeff_b, old_coeff_b - quotient * coeff_b

		# sign correction for negative numbers
		if a < 0:
				snake_case   :    Optional[Any]			       =		-old_coeff_a
		if b < 0:
				snake_case   :    int			       =		-old_coeff_b

		return old_coeff_a, old_coeff_b




def 					_UpperCamelCase		(    )   ->				str:


		'''simple docstring'''


		if len(sys.argv       ) < 3:
				print('''2 integer arguments required'''       )
				return 1
		snake_case   :    str			       =		int(sys.argv[1]       )
		snake_case   :    List[str]			       =		int(sys.argv[2]       )
		print(extended_euclidean_algorithm(SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__       )       )
		return 0


if __name__ == "__main__":
						raise SystemExit(main())


