





import math

class 			__A:

     def __init__(   self,							A   ):





            """simple docstring"""

            _UpperCamelCase														=    len(A   )
            _UpperCamelCase														=    [0] * (
                4 * self.N
            )  # approximate the overall size of segment tree with array N
            self.build(1,							0,							self.N - 1   )

     def 						_UpperCamelCase  (   self,							A   ):





            """simple docstring"""

            return idx * 2

     def 						_UpperCamelCase  (   self,							A   ):





            """simple docstring"""

            return idx * 2 + 1

     def 						_UpperCamelCase  (   self,							A,							A,							A   ):  # noqa: E741





            """simple docstring"""

            if l == r:
                   _UpperCamelCase														=    A[l]
            else:
                   _UpperCamelCase														=    (l + r) // 2
                   self.build(self.left(A   ),							A,							A   )
                   self.build(self.right(A   ),							mid + 1,							A   )
                   _UpperCamelCase														=    max(self.st[self.left(A   )],							self.st[self.right(A   )]   )

     def 						_UpperCamelCase  (   self,							A,							A,							A   ):





            """simple docstring"""

            return self.update_recursive(1,							0,							self.N - 1,							a - 1,							b - 1,							A   )

     def 						_UpperCamelCase  (   self,							A,							A,							A,							A,							A,							A   ):  # noqa: E741





            """simple docstring"""

            if r < a or l > b:
                   return True
            if l == r:
                   _UpperCamelCase														=    val
                   return True
            _UpperCamelCase														=    (l + r) // 2
            self.update_recursive(self.left(A   ),							A,							A,							A,							A,							A   )
            self.update_recursive(self.right(A   ),							mid + 1,							A,							A,							A,							A   )
            _UpperCamelCase														=    max(self.st[self.left(A   )],							self.st[self.right(A   )]   )
            return True

     def 						_UpperCamelCase  (   self,							A,							A   ):





            """simple docstring"""

            return self.query_recursive(1,							0,							self.N - 1,							a - 1,							b - 1   )

     def 						_UpperCamelCase  (   self,							A,							A,							A,							A,							A   ):  # noqa: E741





            """simple docstring"""

            if r < a or l > b:
                   return -math.inf
            if l >= a and r <= b:
                   return self.st[idx]
            _UpperCamelCase														=    (l + r) // 2
            _UpperCamelCase														=    self.query_recursive(self.left(A   ),							A,							A,							A,							A   )
            _UpperCamelCase														=    self.query_recursive(self.right(A   ),							mid + 1,							A,							A,							A   )
            return max(A,							A   )



     def 						_UpperCamelCase  (   self   ):





            """simple docstring"""

            _UpperCamelCase														=    []
            for i in range(1,							N + 1   ):
                   show_list += [self.query(A,							A   )]
            print(A   )


if __name__ == "__main__":
       lowercase     :			Union[str, Any]     						=	[1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
       lowercase     :			List[Any]     						=	15
       lowercase     :			Tuple     						=	SegmentTree(A)
       print(segt.query(4, 6))
       print(segt.query(7, 11))
       print(segt.query(7, 12))
       segt.update(1, 3, 111)
       print(segt.query(1, 15))
       segt.update(7, 8, 235)
       segt.show_data()













def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       ):
       _UpperCamelCase														=    index
       _UpperCamelCase														=    2 * index + 1
       _UpperCamelCase														=    2 * index + 2
       if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
              _UpperCamelCase														=    left_index

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

       if largest != index:
              _UpperCamelCase							,		_UpperCamelCase														=    unsorted[index], unsorted[largest]
              heapify(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )


def      SCREAMING_SNAKE_CASE      (   lowerCAmelCase       ):
       _UpperCamelCase														=    len(lowerCAmelCase       )
       for i in range(n // 2 - 1     ,							-1     ,							-1       ):
              heapify(lowerCAmelCase     ,							lowerCAmelCase     ,							lowerCAmelCase       )
       for i in range(n - 1     ,							0     ,							-1       ):
              _UpperCamelCase							,		_UpperCamelCase														=    unsorted[i], unsorted[0]
              heapify(lowerCAmelCase     ,							0     ,							lowerCAmelCase       )
       return unsorted


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






