

"""simple docstring"""





from __future__ import annotations

from typing import Any







class 							SCREAMING_SNAKE_CASE   (						a_			):






					"""simple docstring"""



					pass







class 							SCREAMING_SNAKE_CASE   :






					"""simple docstring"""



					def __init__(			self     :							List[str]  ,lowercase_     :							Any						):
						lowerCAmelCase__      :		Any    							=      data
						lowerCAmelCase__      :		Node | None    							=      None







					def __iter__(			self     :							List[Any]						):
						lowerCAmelCase__      :		Optional[Any]    							=      self
						lowerCAmelCase__      :		Optional[Any]    							=      []
						while node:
							if node in visited:
								raise ContainsLoopError
							visited.append(lowercase_						)
							yield node.data
							lowerCAmelCase__      :		Any    							=      node.next_node







					@property
					def 			__lowerCAmelCase					(			self     :							str						):
						try:
							list(self						)
							return False
						except ContainsLoopError:
							return True


if __name__ == "__main__":
							__UpperCamelCase    : int				 =						Node(1)
							__UpperCamelCase    : List[Any]				 =						Node(2)
							__UpperCamelCase    : Union[str, Any]				 =						Node(3)
							__UpperCamelCase    : List[Any]				 =						Node(4)
							print(root_node.has_loop)  # False
							__UpperCamelCase    : Dict				 =						root_node.next_node
							print(root_node.has_loop)  # True

							__UpperCamelCase    : str				 =						Node(5)
							__UpperCamelCase    : Optional[Any]				 =						Node(6)
							__UpperCamelCase    : Union[str, Any]				 =						Node(5)
							__UpperCamelCase    : Dict				 =						Node(6)
							print(root_node.has_loop)  # False

							__UpperCamelCase    : Optional[Any]				 =						Node(1)
							print(root_node.has_loop)  # False







"""simple docstring"""





def     __SCREAMING_SNAKE_CASE    ( A_					):
	for i in range(len(A_					) - 1		,	0		,	-1					):
		lowerCAmelCase__      :		Optional[Any]    							=      False

		for j in range(A_		,	0		,	-1					):
			if unsorted[j] < unsorted[j - 1]:
				lowerCAmelCase__							,lowerCAmelCase__      :		Union[str, Any]    							=      unsorted[j - 1], unsorted[j]
				lowerCAmelCase__      :		Dict    							=      True

		for j in range(A_					):
			if unsorted[j] > unsorted[j + 1]:
				lowerCAmelCase__							,lowerCAmelCase__      :		Union[str, Any]    							=      unsorted[j + 1], unsorted[j]
				lowerCAmelCase__      :		Any    							=      True

		if not swapped:
			break
	return unsorted


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__UpperCamelCase    : int				 =						input('''Enter numbers separated by a comma:\n''').strip()
							__UpperCamelCase    : Optional[Any]				 =						[int(item) for item in user_input.split(''',''')]
							print(F'''{cocktail_shaker_sort(unsorted) = }''')




