


from __future__ import annotations


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

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

				return permissible_positions


def __lowercase     (      lowerCamelCase_  :      list[list[int]]  ):
				return not any(elem == 0 for row in board for elem in row  )


def __lowercase     (      lowerCamelCase_  :      list[list[int]]						,					lowerCamelCase_  :      tuple[int, int]						,					lowerCamelCase_  :      int  ):


				if is_complete(_UpperCamelCase  ):
								return True

				for position in get_valid_pos(_UpperCamelCase						,					len(_UpperCamelCase  )  ):
								SCREAMING_SNAKE_CASE__							,      SCREAMING_SNAKE_CASE__     							=				position

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

				return False


def __lowercase     (      lowerCamelCase_  :      int  ):
				SCREAMING_SNAKE_CASE__     							=				[[0 for i in range(_UpperCamelCase  )] for j in range(_UpperCamelCase  )]

				for i in range(_UpperCamelCase  ):
								for j in range(_UpperCamelCase  ):
												SCREAMING_SNAKE_CASE__     							=				1
												if open_knight_tour_helper(_UpperCamelCase						,					(i, j)						,					1  ):
																return board
												SCREAMING_SNAKE_CASE__     							=				0

				SCREAMING_SNAKE_CASE__     							=				F'''Open Kight Tour cannot be performed on a board of size {n}'''
				raise ValueError(_UpperCamelCase  )


if __name__ == "__main__":
	import doctest

	doctest.testmod()




"""simple docstring"""






from __future__ import annotations


def __lowercase     (      lowerCamelCase_  :      list						,					lowerCamelCase_  :      int						,					lowerCamelCase_  :      int						,					lowerCamelCase_  :      int  ):
				SCREAMING_SNAKE_CASE__     							=				[]
				SCREAMING_SNAKE_CASE__							,      SCREAMING_SNAKE_CASE__     							=				input_list[low:mid], input_list[mid : high + 1]
				while left and right:
								result.append((left if left[0] <= right[0] else right).pop(0  )  )
				SCREAMING_SNAKE_CASE__     							=				result + left + right
				return input_list


def __lowercase     (      lowerCamelCase_  :      list  ):
				if len(lowerCamelCase_  ) <= 1:
								return input_list
				SCREAMING_SNAKE_CASE__     							=				list(lowerCamelCase_  )

				# iteration for two-way merging
				SCREAMING_SNAKE_CASE__     							=				2
				while p <= len(lowerCamelCase_  ):
								# getting low, high and middle value for merge-sort of single list
								for i in range(0						,					len(lowerCamelCase_  )						,					lowerCamelCase_  ):
												SCREAMING_SNAKE_CASE__     							=				i
												SCREAMING_SNAKE_CASE__     							=				i + p - 1
												SCREAMING_SNAKE_CASE__     							=				(low + high + 1) // 2
												SCREAMING_SNAKE_CASE__     							=				merge(lowerCamelCase_						,					lowerCamelCase_						,					lowerCamelCase_						,					lowerCamelCase_  )
								# final merge of last two parts
								if p * 2 >= len(lowerCamelCase_  ):
												SCREAMING_SNAKE_CASE__     							=				i
												SCREAMING_SNAKE_CASE__     							=				merge(lowerCamelCase_						,					0						,					lowerCamelCase_						,					len(lowerCamelCase_  ) - 1  )
												break
								p *= 2

				return input_list


if __name__ == "__main__":
	_lowerCamelCase     =  input('Enter numbers separated by a comma:\n').strip()
	if user_input == "":
		_lowerCamelCase     =  []
	else:
		_lowerCamelCase     =  [int(item.strip()) for item in user_input.split(',')]
	print(iter_merge_sort(unsorted))
