
'''simple docstring'''







from __future__ import annotations

from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any


class       lowerCAmelCase			:
		a				:       Union[str, Any]							=       ("""_front""", """_back""", """_len""")


		@dataclass
		class       lowerCAmelCase			:
				a				:       Any							=       None
				a				:       Deque._Node | None							=       None
				a				:       Deque._Node | None							=       None


		class       lowerCAmelCase			:
				a				:       str							=       ("""_cur""",)




				def __init__(					self       ,    UpperCamelCase   ):
										_SCREAMING_SNAKE_CASE					=			cur




				def __iter__(					self   ):
										return self




				def      lowercase							(					self   ):
										if self._cur is None:
																# finished iterating
																raise StopIteration
										_SCREAMING_SNAKE_CASE					=			self._cur.val
										_SCREAMING_SNAKE_CASE					=			self._cur.next_node

										return val




		def __init__(					self       ,    UpperCamelCase = None   ):
								_SCREAMING_SNAKE_CASE					=			None
								_SCREAMING_SNAKE_CASE					=			None
								_SCREAMING_SNAKE_CASE					=			0

								if iterable is not None:
														# append every value to the deque
														for val in iterable:
																				self.append(UpperCamelCase   )




		def      lowercase							(					self       ,    UpperCamelCase   ):
								_SCREAMING_SNAKE_CASE					=			self._Node(UpperCamelCase       ,    UpperCamelCase       ,    UpperCamelCase   )
								if self.is_empty():
														# front = back
														_SCREAMING_SNAKE_CASE					=			_SCREAMING_SNAKE_CASE					=			node
														_SCREAMING_SNAKE_CASE					=			1
								else:
														# connect nodes
														_SCREAMING_SNAKE_CASE					=			node
														_SCREAMING_SNAKE_CASE					=			self._back
														_SCREAMING_SNAKE_CASE					=			node  # assign new back to the new node

														self._len += 1

														# make sure there were no errors
														assert not self.is_empty(), "Error on appending value."




		def      lowercase							(					self       ,    UpperCamelCase   ):
								_SCREAMING_SNAKE_CASE					=			self._Node(UpperCamelCase       ,    UpperCamelCase       ,    UpperCamelCase   )
								if self.is_empty():
														# front = back
														_SCREAMING_SNAKE_CASE					=			_SCREAMING_SNAKE_CASE					=			node
														_SCREAMING_SNAKE_CASE					=			1
								else:
														# connect nodes
														_SCREAMING_SNAKE_CASE					=			self._front
														_SCREAMING_SNAKE_CASE					=			node
														_SCREAMING_SNAKE_CASE					=			node  # assign new front to the new node

														self._len += 1

														# make sure there were no errors
														assert not self.is_empty(), "Error on appending value."




		def      lowercase							(					self       ,    UpperCamelCase   ):
								for val in iterable:
														self.append(UpperCamelCase   )




		def      lowercase							(					self       ,    UpperCamelCase   ):
								for val in iterable:
														self.appendleft(UpperCamelCase   )




		def      lowercase							(					self   ):
								assert not self.is_empty(), "Deque is empty."

								_SCREAMING_SNAKE_CASE					=			self._back
								_SCREAMING_SNAKE_CASE					=			self._back.prev_node  # set new back
								# drop the last node - python will deallocate memory automatically
								_SCREAMING_SNAKE_CASE					=			None

								self._len -= 1

								return topop.val




		def      lowercase							(					self   ):
								assert not self.is_empty(), "Deque is empty."

								_SCREAMING_SNAKE_CASE					=			self._front
								_SCREAMING_SNAKE_CASE					=			self._front.next_node  # set new front and drop the first node
								_SCREAMING_SNAKE_CASE					=			None

								self._len -= 1

								return topop.val




		def      lowercase							(					self   ):
								return self._front is None




		def __len__(					self   ):
								return self._len




		def __eq__(					self       ,    UpperCamelCase   ):

								if not isinstance(UpperCamelCase       ,    UpperCamelCase   ):
														return NotImplemented

								_SCREAMING_SNAKE_CASE					=			self._front
								_SCREAMING_SNAKE_CASE					=			other._front

								# if the length of the dequeues are not the same, they are not equal
								if len(self   ) != len(UpperCamelCase   ):
														return False

								while me is not None and oth is not None:
														# compare every value
														if me.val != oth.val:
																				return False
														_SCREAMING_SNAKE_CASE					=			me.next_node
														_SCREAMING_SNAKE_CASE					=			oth.next_node

								return True




		def __iter__(					self   ):
								return Deque._Iterator(self._front   )




		def __repr__(					self   ):
								_SCREAMING_SNAKE_CASE					=			[]
								_SCREAMING_SNAKE_CASE					=			self._front
								while aux is not None:
														# append the values in a list to display
														values_list.append(aux.val   )
														_SCREAMING_SNAKE_CASE					=			aux.next_node

								return F'[{", ".join(repr(UpperCamelCase   ) for val in values_list   )}]'


if __name__ == "__main__":
						import doctest

						doctest.testmod()

'''simple docstring'''







def       _a		(						_SCREAMING_SNAKE_CASE		: str	):
						_SCREAMING_SNAKE_CASE					=			len(_SCREAMING_SNAKE_CASE	)
						for i in range(length - 1	):
												_SCREAMING_SNAKE_CASE					=			False
												for j in range(length - 1 - i	):
																		if collection[j] > collection[j + 1]:
																								_SCREAMING_SNAKE_CASE					=			True
																								_SCREAMING_SNAKE_CASE,				_SCREAMING_SNAKE_CASE					=			collection[j + 1], collection[j]
												if not swapped:
																		break  # Stop iteration if the collection is sorted.
						return collection


if __name__ == "__main__":
						import doctest
						import time

						doctest.testmod()

						_snake_case					: Union[str, Any]     			=					input("""Enter numbers separated by a comma:""").strip()
						_snake_case					: List[Any]     			=					[int(item) for item in user_input.split(""",""")]
						_snake_case					: Optional[int]     			=					time.process_time()
						print(*bubble_sort(unsorted), sep=""",""")
						print(F"Processing time: {(time.process_time() - start)%1E9 + 7}")