'''simple docstring'''


def  _lowerCamelCase   (				lowerCamelCase_ :							Dict       ):



     """simple docstring"""





     stooge(lowerCamelCase_     ,					0     ,					len(lowerCamelCase_       ) - 1       )
     return arr


def  _lowerCamelCase   (				lowerCamelCase_ :							Optional[int]     ,					lowerCamelCase_ :							Optional[Any]     ,					lowerCamelCase_ :							Optional[Any]       ):



     """simple docstring"""





     if i >= h:
          return

     # If first element is smaller than the last then swap them
     if arr[i] > arr[h]:
          UpperCAmelCase_       ,      UpperCAmelCase_							:       Optional[Any]       =				arr[h], arr[i]

     # If there are more than 2 elements in the array
     if h - i + 1 > 2:
          UpperCAmelCase_							:       List[Any]       =				(int)((h - i + 1) / 3       )

          # Recursively sort first 2/3 elements
          stooge(lowerCamelCase_     ,					lowerCamelCase_     ,					(h - t)       )

          # Recursively sort last 2/3 elements
          stooge(lowerCamelCase_     ,					i + t     ,					(lowerCamelCase_)       )

          # Recursively sort first 2/3 elements
          stooge(lowerCamelCase_     ,					lowerCamelCase_     ,					(h - t)       )


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







'''simple docstring'''


from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass






@dataclass
class 					__SCREAMING_SNAKE_CASE						:







  '''simple docstring'''






  lowerCamelCase_		:int
  lowerCamelCase_		:int







class 					__SCREAMING_SNAKE_CASE						:







  '''simple docstring'''






  def __init__(			self				,		snake_case_						):




       '''simple docstring'''

       UpperCAmelCase_							:       list[list[Edge]]       =				[[] for _ in range(snake_case_						)]
       UpperCAmelCase_							:       Any       =				size


  def __getitem__(			self				,		snake_case_						):




       '''simple docstring'''

       return iter(self._graph[vertex]						)


  @property
  def _UpperCamelCase					(			self						):




       '''simple docstring'''

       return self._size


  def _UpperCamelCase					(			self				,		snake_case_				,		snake_case_				,		snake_case_						):




       '''simple docstring'''

       if weight not in (0, 1):
            raise ValueError('Edge weight must be either 0 or 1.'						)

       if to_vertex < 0 or to_vertex >= self.size:
            raise ValueError('Vertex indexes must be in [0; size).'						)

       self._graph[from_vertex].append(Edge(snake_case_				,		snake_case_						)						)






  def _UpperCamelCase					(			self				,		snake_case_				,		snake_case_						):




       '''simple docstring'''

       UpperCAmelCase_							:       Optional[int]       =				deque([start_vertex]						)
       UpperCAmelCase_							:       list[int | None]       =				[None] * self.size
       UpperCAmelCase_							:       str       =				0

       while queue:
            UpperCAmelCase_							:       Optional[int]       =				queue.popleft()
            UpperCAmelCase_							:       List[str]       =				distances[current_vertex]
            if current_distance is None:
                 continue

            for edge in self[current_vertex]:
                 UpperCAmelCase_							:       Union[str, Any]       =				current_distance + edge.weight
                 UpperCAmelCase_							:       Union[str, Any]       =				distances[edge.destination_vertex]
                 if (
                     isinstance(snake_case_				,		snake_case_						)
                     and new_distance >= dest_vertex_distance
                 ):
                      continue
                 UpperCAmelCase_							:       Optional[Any]       =				new_distance
                 if edge.weight == 0:
                      queue.appendleft(edge.destination_vertex						)
                 else:
                      queue.append(edge.destination_vertex						)

       if distances[finish_vertex] is None:
            raise ValueError('No path from start_vertex to finish_vertex.'						)

       return distances[finish_vertex]


if __name__ == "__main__":
 import doctest

 doctest.testmod()






