




'''simple docstring'''





class   _a							:






     def __init__(					self   ,_SCREAMING_SNAKE_CASE       )				->     Dict:
          _snake_case				= set_counts
          _snake_case				= max(_SCREAMING_SNAKE_CASE       )
          _snake_case				= len(_SCREAMING_SNAKE_CASE       )
          _snake_case				= [1] * num_sets
          _snake_case				= list(range(_SCREAMING_SNAKE_CASE       )       )






     def 							_lowercase      (					self   ,_SCREAMING_SNAKE_CASE   ,_SCREAMING_SNAKE_CASE       )				->     Tuple:
          _snake_case				= self.get_parent(_SCREAMING_SNAKE_CASE       )
          _snake_case				= self.get_parent(_SCREAMING_SNAKE_CASE       )

          if src_parent == dst_parent:
               return False

          if self.ranks[dst_parent] >= self.ranks[src_parent]:
               self.set_counts[dst_parent] += self.set_counts[src_parent]
               _snake_case				= 0
               _snake_case				= dst_parent
               if self.ranks[dst_parent] == self.ranks[src_parent]:
                    self.ranks[dst_parent] += 1
               _snake_case				= self.set_counts[dst_parent]
          else:
               self.set_counts[src_parent] += self.set_counts[dst_parent]
               _snake_case				= 0
               _snake_case				= src_parent
               _snake_case				= self.set_counts[src_parent]

          _snake_case				= max(self.max_set   ,_SCREAMING_SNAKE_CASE       )
          return True






     def 							_lowercase      (					self   ,_SCREAMING_SNAKE_CASE       )				->     Optional[Any]:


          if self.parents[disj_set] == disj_set:
               return disj_set
          _snake_case				= self.get_parent(self.parents[disj_set]       )
          return self.parents[disj_set]







def        __a			(   __lowerCAmelCase   )     ->     List[str]:
					stooge(__lowerCAmelCase      ,	0      ,	len(__lowerCAmelCase   ) - 1   )
					return arr

def        __a			(   __lowerCAmelCase      ,	__lowerCAmelCase      ,	__lowerCAmelCase   )     ->     int:
					if i >= h:
										return

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

					# If there are more than 2 elements in the array
					if h - i + 1 > 2:
										SCREAMING_SNAKE_CASE							:     Union[str, 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__":
			_lowerCamelCase    :		List[str]		      =    input("""Enter numbers separated by a comma:\n""").strip()
			_lowerCamelCase    :		List[Any]		      =    [int(item) for item in user_input.split(""",""")]
			print(stooge_sort(unsorted))