
"""simple docstring"""


def 					_snake_case (						snake_case__      :   int		,					snake_case__      :   int   ):


	while b:
		A        =      b, a % b
	return a






def 					_snake_case (						snake_case__      :   int		,					snake_case__      :   int   ):
	return a if b == 0 else euclidean_gcd_recursive(__snake_case		,					a % b   )






def 					_snake_case (						):
	print(F'euclidean_gcd(3, 5) = {euclidean_gcd(3		,					5   )}'   )
	print(F'euclidean_gcd(5, 3) = {euclidean_gcd(5		,					3   )}'   )
	print(F'euclidean_gcd(1, 3) = {euclidean_gcd(1		,					3   )}'   )
	print(F'euclidean_gcd(3, 6) = {euclidean_gcd(3		,					6   )}'   )
	print(F'euclidean_gcd(6, 3) = {euclidean_gcd(6		,					3   )}'   )

	print(F'euclidean_gcd_recursive(3, 5) = {euclidean_gcd_recursive(3		,					5   )}'   )
	print(F'euclidean_gcd_recursive(5, 3) = {euclidean_gcd_recursive(5		,					3   )}'   )
	print(F'euclidean_gcd_recursive(1, 3) = {euclidean_gcd_recursive(1		,					3   )}'   )
	print(F'euclidean_gcd_recursive(3, 6) = {euclidean_gcd_recursive(3		,					6   )}'   )
	print(F'euclidean_gcd_recursive(6, 3) = {euclidean_gcd_recursive(6		,					3   )}'   )


if __name__ == "__main__":
		main()







from __future__ import annotations




def      lowercase__      (     __snake_case    :							tuple[int, int]     ,       __snake_case    :							int  ):


					'''simple docstring'''


					UpperCAmelCase_       ,  UpperCAmelCase_    :      Tuple            =						position
					UpperCAmelCase_    :      str            =						[
					    (y + 1, x + 2),
					    (y - 1, x + 2),
					    (y + 1, x - 2),
					    (y - 1, x - 2),
					    (y + 2, x + 1),
					    (y + 2, x - 1),
					    (y - 2, x + 1),
					    (y - 2, x - 1),
					]
					UpperCAmelCase_    :      Optional[Any]            =						[]

					for position in positions:
										UpperCAmelCase_       ,  UpperCAmelCase_    :      Tuple            =						position
										if 0 <= y_test < n and 0 <= x_test < n:
															permissible_positions.append(__snake_case  )

					return permissible_positions




def      lowercase__      (     __snake_case    :							list[list[int]]  ):


					'''simple docstring'''


					return not any(elem == 0 for row in board for elem in row  )




def      lowercase__      (     __snake_case    :							list[list[int]]     ,       __snake_case    :							tuple[int, int]     ,       __snake_case    :							int  ):


					'''simple docstring'''


					if is_complete(__snake_case  ):
										return True

					for position in get_valid_pos(__snake_case     ,       len(__snake_case  )  ):
										UpperCAmelCase_       ,  UpperCAmelCase_    :      Any            =						position

										if board[y][x] == 0:
															UpperCAmelCase_    :      Optional[Any]            =						curr + 1
															if open_knight_tour_helper(__snake_case     ,       __snake_case     ,       curr + 1  ):
																				return True
															UpperCAmelCase_    :      List[Any]            =						0

					return False




def      lowercase__      (     __snake_case    :							int  ):


					'''simple docstring'''


					UpperCAmelCase_    :      str            =						[[0 for i in range(__snake_case  )] for j in range(__snake_case  )]

					for i in range(__snake_case  ):
										for j in range(__snake_case  ):
															UpperCAmelCase_    :      Optional[Any]            =						1
															if open_knight_tour_helper(__snake_case     ,       (i, j)     ,       1  ):
																				return board
															UpperCAmelCase_    :      List[Any]            =						0

					UpperCAmelCase_    :      List[str]            =						F"Open Kight Tour cannot be performed on a board of size {n}"
					raise ValueError(__snake_case  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()






