

def        __UpperCamelCase     (      _A					:							Optional[Any]      ,  _A					:							Optional[int]      ,  _A					:							Optional[int]		)				->List[str]:



							"""simple docstring"""
							lowerCamelCase_								=index
							lowerCamelCase_								=2 * index + 1
							lowerCamelCase_								=2 * index + 2
							if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
														lowerCamelCase_								=left_index

							if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
														lowerCamelCase_								=right_index

							if largest != index:
														lowerCamelCase_								=unsorted[index], unsorted[largest]
														heapify(__lowerCamelCase      ,  __lowerCamelCase      ,  __lowerCamelCase		)




def        __UpperCamelCase     (      _A					:							Optional[int]		)				->Dict:



							"""simple docstring"""
							lowerCamelCase_								=len(__lowerCamelCase		)
							for i in range(n // 2 - 1      ,  -1      ,  -1		):
														heapify(__lowerCamelCase      ,  __lowerCamelCase      ,  __lowerCamelCase		)
							for i in range(n - 1      ,  0      ,  -1		):
														lowerCamelCase_								=unsorted[i], unsorted[0]
														heapify(__lowerCamelCase      ,  0      ,  __lowerCamelCase		)
							return unsorted


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





from __future__ import annotations

from collections.abc import Iterable, Iterator
from typing import Any, Generic, TypeVar

_lowerCamelCase         =	TypeVar("""T""", bound=bool)

class    _SCREAMING_SNAKE_CASE						(Generic[T]			):





     def __init__(							self			:				List[Any]  ,	UpperCamelCase			:				T					)->None:
      __SCREAMING_SNAKE_CASE							:     T							=						value
      __SCREAMING_SNAKE_CASE							:     SkewNode[T] | None							=						None
      __SCREAMING_SNAKE_CASE							:     SkewNode[T] | None							=						None





     @property
     def 						__snake_case     (							self			:				Dict					)->T:
      return self._value






     @staticmethod
     def 						__snake_case     (							UpperCamelCase			:				SkewNode[T] | None  ,	UpperCamelCase			:				SkewNode[T] | None					)->SkewNode[T] | None:
      if not roota:
       return roota

      if not roota:
       return roota

      if roota.value > roota.value:
       __SCREAMING_SNAKE_CASE,		__SCREAMING_SNAKE_CASE							:     List[Any]							=						roota, roota

      __SCREAMING_SNAKE_CASE							:     int							=						roota
      __SCREAMING_SNAKE_CASE							:     str							=						roota.right
      __SCREAMING_SNAKE_CASE							:     int							=						roota.left
      __SCREAMING_SNAKE_CASE							:     Optional[int]							=						SkewNode.merge(UpperCamelCase  ,	UpperCamelCase					)

      return result






class    _SCREAMING_SNAKE_CASE						(Generic[T]			):





     def __init__(							self			:				str  ,	UpperCamelCase			:				Iterable[T] | None = ()					)->None:
      __SCREAMING_SNAKE_CASE							:     SkewNode[T] | None							=						None
      if data:
       for item in data:
        self.insert(UpperCamelCase					)





     def __bool__(							self			:				str					)->bool:
      return self._root is not None





     def __iter__(							self			:				Any					)->Iterator[T]:
      __SCREAMING_SNAKE_CASE							:     list[Any]							=						[]
      while self:
       result.append(self.pop()					)

      # Pushing items back to the heap not to clear it.
      for item in result:
       self.insert(UpperCamelCase					)

      return iter(UpperCamelCase					)





     def 						__snake_case     (							self			:				List[Any]  ,	UpperCamelCase			:				T					)->None:
      __SCREAMING_SNAKE_CASE							:     str							=						SkewNode.merge(self._root  ,	SkewNode(UpperCamelCase					)					)





     def 						__snake_case     (							self			:				List[Any]					)->T | None:
      __SCREAMING_SNAKE_CASE							:     Any							=						self.top()
      __SCREAMING_SNAKE_CASE							:     List[Any]							=						(
          SkewNode.merge(self._root.left  ,	self._root.right					) if self._root else None
      )

      return result





     def 						__snake_case     (							self			:				Optional[int]					)->T:
      if not self._root:
       raise IndexError("Can't get top element for the empty heap."					)
      return self._root.value






     def 						__snake_case     (							self			:				Dict					)->None:
      __SCREAMING_SNAKE_CASE							:     Optional[Any]							=						None


if __name__ == "__main__":
      import doctest

      doctest.testmod()






