
"""simple docstring"""

def 		UpperCAmelCase					(		a_,						a_,						a_			):





		'''simple docstring'''


		lowerCamelCase     :			Tuple		=    index
		lowerCamelCase     :			Any		=    2 * index + 1
		lowerCamelCase     :			Any		=    2 * index + 2
		if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
				lowerCamelCase     :			List[str]		=    left_index

		if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
				lowerCamelCase     :			Optional[int]		=    right_index

		if largest != index:
				lowerCamelCase     :			str		=    unsorted[index], unsorted[largest]
				heapify(a_,						a_,						a_			)
def 		UpperCAmelCase					(		a_			):





		'''simple docstring'''


		lowerCamelCase     :			Union[str, Any]		=    len(a_			)
		for i in range(n // 2 - 1,						-1,						-1			):
				heapify(a_,						a_,						a_			)
		for i in range(n - 1,						0,						-1			):
				lowerCamelCase     :			Any		=    unsorted[i], unsorted[0]
				heapify(a_,						0,						a_			)
		return unsorted


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














"""simple docstring"""



def      SCREAMING_SNAKE_CASE__    (   snake_case    :      list       , snake_case    :      int       , snake_case    :      int							)->						None:






     '''simple docstring'''



     if right <= left:
          return
     UpperCAmelCase__		:  str				=				left
     UpperCAmelCase__		:  List[str]				=				right
     UpperCAmelCase__		:  List[Any]				=				sorting[left]
     while i <= b:
          if sorting[i] < pivot:
               UpperCAmelCase__				,							UpperCAmelCase__		:  List[str]				=				sorting[i], sorting[a]
               a += 1
               i += 1
          elif sorting[i] > pivot:
               UpperCAmelCase__				,							UpperCAmelCase__		:  Optional[int]				=				sorting[i], sorting[b]
               b -= 1
          else:
               i += 1
     quick_sort_apartition(snake_case       , snake_case       , a - 1							)
     quick_sort_apartition(snake_case       , b + 1       , snake_case							)


def      SCREAMING_SNAKE_CASE__    (   snake_case    :      list       , snake_case    :      int       , snake_case    :      int							)->						None:






     '''simple docstring'''



     if left < right:
          UpperCAmelCase__		:  int				=				lomuto_partition(snake_case       , snake_case       , snake_case							)
          quick_sort_lomuto_partition(snake_case       , snake_case       , pivot_index - 1							)
          quick_sort_lomuto_partition(snake_case       , pivot_index + 1       , snake_case							)


def      SCREAMING_SNAKE_CASE__    (   snake_case    :      list       , snake_case    :      int       , snake_case    :      int							)->						int:






     '''simple docstring'''



     UpperCAmelCase__		:  Union[str, Any]				=				sorting[right]
     UpperCAmelCase__		:  Optional[Any]				=				left
     for i in range(snake_case       , snake_case							):
          if sorting[i] < pivot:
               UpperCAmelCase__				,							UpperCAmelCase__		:  List[Any]				=				sorting[i], sorting[store_index]
               store_index += 1
     UpperCAmelCase__				,							UpperCAmelCase__		:  List[Any]				=				sorting[store_index], sorting[right]
     return store_index


def      SCREAMING_SNAKE_CASE__    (   snake_case    :      list							)->						list:






     '''simple docstring'''



     if len(snake_case							) <= 1:
          return sorting
     return (
         three_way_radix_quicksort([i for i in sorting if i < sorting[0]]							)
         + [i for i in sorting if i == sorting[0]]
         + three_way_radix_quicksort([i for i in sorting if i > sorting[0]]							)
     )


if __name__ == "__main__":
 import doctest

 doctest.testmod(verbose=True)

 _lowerCAmelCase     :     Optional[int]            =	input("""Enter numbers separated by a comma:\n""").strip()
 _lowerCAmelCase     :     str            =	[int(item) for item in user_input.split(""",""")]
 quick_sort_apartition(unsorted, 0, len(unsorted) - 1)
 print(unsorted)


