





from __future__ import annotations






def 			_SCREAMING_SNAKE_CASE						(     SCREAMING_SNAKE_CASE						:str       ,       SCREAMING_SNAKE_CASE						:Union[str, Any]       )     ->       str:
 # Checks if the entire collection has been sorted
 if len(SCREAMING_SNAKE_CASE       ) <= 1 or n <= 1:
  return

 insert_next(SCREAMING_SNAKE_CASE       ,       n - 1       )
 rec_insertion_sort(SCREAMING_SNAKE_CASE       ,       n - 1       )






def 			_SCREAMING_SNAKE_CASE						(     SCREAMING_SNAKE_CASE						:List[Any]       ,       SCREAMING_SNAKE_CASE						:Optional[Any]       )     ->       Optional[Any]:
 # Checks order between adjacent elements
 if index >= len(SCREAMING_SNAKE_CASE       ) or collection[index - 1] <= collection[index]:
  return

 # Swaps adjacent elements since they are not in ascending order
 __lowerCAmelCase   ,	__lowerCAmelCase	:			Any         =  (
     collection[index],
     collection[index - 1],
 )

 insert_next(SCREAMING_SNAKE_CASE       ,       index + 1       )


if __name__ == "__main__":
      _UpperCAmelCase       =				input('Enter integers separated by spaces: ')
      _UpperCAmelCase       =				[int(num) for num in numbers.split()]
      rec_insertion_sort(number_list, len(number_list))
      print(number_list)






from __future__ import annotations



def  SCREAMING_SNAKE_CASE				(      snake_case						,   snake_case							)		->    list[tuple[int, int]]:
		__lowercase						,      __lowercase											=     position
		__lowercase											=     [
		    (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),
		]
		__lowercase											=     []

		for position in positions:
				__lowercase						,      __lowercase											=     position
				if 0 <= y_test < n and 0 <= x_test < n:
						permissible_positions.append(snake_case							)

		return permissible_positions



def  SCREAMING_SNAKE_CASE				(      snake_case							)		->    bool:
		return not any(elem == 0 for row in board for elem in row							)



def  SCREAMING_SNAKE_CASE				(      snake_case						,   snake_case						,   snake_case							)		->    bool:

		if is_complete(snake_case							):
				return True

		for position in get_valid_pos(snake_case						,   len(snake_case							)							):
				__lowercase						,      __lowercase											=     position

				if board[y][x] == 0:
						__lowercase											=     curr + 1
						if open_knight_tour_helper(snake_case						,   snake_case						,   curr + 1							):
								return True
						__lowercase											=     0

		return False



def  SCREAMING_SNAKE_CASE				(      snake_case							)		->    list[list[int]]:
		__lowercase											=     [[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							):
						__lowercase											=     1
						if open_knight_tour_helper(snake_case						,   (i, j)						,   1							):
								return board
						__lowercase											=     0

		__lowercase											=     F"Open Kight Tour cannot be performed on a board of size {n}"
		raise ValueError(snake_case							)


if __name__ == "__main__":
		import doctest

		doctest.testmod()




