
from __future__ import annotations

import math



class 						UpperCamelCase__    :
   def __init__(self					:   str   ,							snake_case_					:   int  ):
    __a					:    List[Any]													=    size
    # approximate the overall size of segment tree with given value
    __a					:    Optional[Any]													=    [0 for i in range(0   ,							4 * size  )]
    # create array to store lazy update
    __a					:    str													=    [0 for i in range(0   ,							4 * size  )]
    __a					:    List[str]													=    [0 for i in range(0   ,							4 * size  )]  # flag for lazy update
   def  lowerCAmelCase     (self					:   Union[str, Any]   ,							snake_case_					:   int  ):
    return idx * 2
   def  lowerCAmelCase     (self					:   Any   ,							snake_case_					:   int  ):
    return idx * 2 + 1
   def  lowerCAmelCase     (self					:   Any   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   list[int]  ):
    if left_element == right_element:
     __a					:    Dict													=    a[left_element - 1]
    else:
     __a					:    Any													=    (left_element + right_element) // 2
     self.build(self.left(A_  )   ,							A_   ,							A_   ,							A_  )
     self.build(self.right(A_  )   ,							mid + 1   ,							A_   ,							A_  )
     __a					:    Dict													=    max(
         self.segment_tree[self.left(A_  )]   ,							self.segment_tree[self.right(A_  )]  )
   def  lowerCAmelCase     (self					:   List[Any]   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int  ):
    if self.flag[idx] is True:
     __a					:    List[Any]													=    self.lazy[idx]
     __a					:    List[Any]													=    False
     if left_element != right_element:
      __a					:    Any													=    self.lazy[idx]
      __a					:    Any													=    self.lazy[idx]
      __a					:    List[str]													=    True
      __a					:    Dict													=    True

    if right_element < a or left_element > b:
     return True
    if left_element >= a and right_element <= b:
     __a					:    Optional[int]													=    val
     if left_element != right_element:
      __a					:    Union[str, Any]													=    val
      __a					:    int													=    val
      __a					:    List[str]													=    True
      __a					:    Optional[int]													=    True
     return True
    __a					:    Optional[Any]													=    (left_element + right_element) // 2
    self.update(self.left(A_  )   ,							A_   ,							A_   ,							A_   ,							A_   ,							A_  )
    self.update(self.right(A_  )   ,							mid + 1   ,							A_   ,							A_   ,							A_   ,							A_  )
    __a					:    Any													=    max(
        self.segment_tree[self.left(A_  )]   ,							self.segment_tree[self.right(A_  )]  )
    return True
   def  lowerCAmelCase     (self					:   Any   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int   ,							snake_case_					:   int  ):
    if self.flag[idx] is True:
     __a					:    str													=    self.lazy[idx]
     __a					:    Union[str, Any]													=    False
     if left_element != right_element:
      __a					:    str													=    self.lazy[idx]
      __a					:    str													=    self.lazy[idx]
      __a					:    Union[str, Any]													=    True
      __a					:    List[Any]													=    True
    if right_element < a or left_element > b:
     return -math.inf
    if left_element >= a and right_element <= b:
     return self.segment_tree[idx]
    __a					:    Optional[Any]													=    (left_element + right_element) // 2
    __a					:    Union[str, Any]													=    self.query(self.left(A_  )   ,							A_   ,							A_   ,							A_   ,							A_  )
    __a					:    Any													=    self.query(self.right(A_  )   ,							mid + 1   ,							A_   ,							A_   ,							A_  )
    return max(A_   ,							A_  )







   def __str__(self					:   Union[str, Any]  ):
    return str([self.query(1   ,							1   ,							self.size   ,							A_   ,							A_  ) for i in range(1   ,							self.size + 1  )]  )


if __name__ == "__main__":
      lowercase__         =[1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
      lowercase__         =15
      lowercase__         =SegmentTree(size)
      segt.build(1, 1, size, A)
      print(segt.query(1, 1, size, 4, 6))
      print(segt.query(1, 1, size, 7, 11))
      print(segt.query(1, 1, size, 7, 12))
      segt.update(1, 1, size, 1, 3, 111)
      print(segt.query(1, 1, size, 1, 15))
      segt.update(1, 1, size, 7, 8, 235)
      print(segt)


"""simple docstring"""


import copy
import re







class 					lowerCAmelCase_					:



						'''simple docstring'''


						_lowerCamelCase:     str   =     '''hp'''
						_lowerCamelCase:     List[Any]   =     {}
						_lowerCamelCase:     List[Any]   =     None


						@classmethod
						def     _SCREAMING_SNAKE_CASE   (			cls  :   List[Any]	,A_  :   List[str]	,A_  :   Optional[Any]   )  -> Tuple:
							A     = prefix
							A     = defaults
							cls.build_naming_info()


						@staticmethod
						def     _SCREAMING_SNAKE_CASE   (			A_  :   Any	,A_  :   List[Any]   )  -> int:
							if len(A_   ) == 0:
								return ""
							A     = None
							if any(char.isdigit() for char in word   ):
								raise Exception(F'Parameters should not contain numbers: \'{word}\' contains a number'   )
							if word in info["short_word"]:
								return info["short_word"][word]
							for prefix_len in range(1	,len(A_   ) + 1   ):
								A     = word[:prefix_len]
								if prefix in info["reverse_short_word"]:
									continue
								else:
									A     = prefix
									break

							if short_word is None:
								# Paranoid fallback
								def int_to_alphabetic(A_  :   Optional[Any]   ):
									A     = ''
									while integer != 0:
										A     = chr(ord('A'   ) + integer % 10   ) + s
										integer //= 10
									return s

								A     = 0
								while True:
									A     = word + '#' + int_to_alphabetic(A_   )
									if sword in info["reverse_short_word"]:
										continue
									else:
										A     = sword
										break

							A     = short_word
							A     = word
							return short_word


						@staticmethod
						def     _SCREAMING_SNAKE_CASE   (			A_  :   List[Any]	,A_  :   Union[str, Any]   )  -> Union[str, Any]:
							A     = param_name.split('_'   )

							A     = [TrialShortNamer.shortname_for_word(A_	,A_   ) for word in words]

							# We try to create a separatorless short name, but if there is a collision we have to fallback
							# to a separated short name
							A     = ['', '_']

							for separator in separators:
								A     = separator.join(A_   )
								if shortname not in info["reverse_short_param"]:
									A     = shortname
									A     = param_name
									return shortname

							return param_name


						@staticmethod
						def     _SCREAMING_SNAKE_CASE   (			A_  :   List[Any]	,A_  :   Any   )  -> Tuple:
							A     = TrialShortNamer.shortname_for_key(A_	,A_   )
							A     = short_name
							A     = param_name


						@classmethod
						def     _SCREAMING_SNAKE_CASE   (			cls  :   Dict   )  -> List[Any]:
							if cls.NAMING_INFO is not None:
								return

							A     = {
							    'short_word': {},
							    'reverse_short_word': {},
							    'short_param': {},
							    'reverse_short_param': {},
							}

							A     = list(cls.DEFAULTS.keys()   )

							for k in field_keys:
								cls.add_new_param_name(A_	,A_   )

							A     = info


						@classmethod
						def     _SCREAMING_SNAKE_CASE   (			cls  :   List[Any]	,A_  :   Union[str, Any]   )  -> Union[str, Any]:
							cls.build_naming_info()
							assert cls.PREFIX is not None
							A     = [copy.copy(cls.PREFIX   )]

							for k, v in params.items():
								if k not in cls.DEFAULTS:
									raise Exception(F'You should provide a default value for the param name {k} with value {v}'   )
								if v == cls.DEFAULTS[k]:
									# The default value is not added to the name
									continue

								A     = cls.NAMING_INFO['short_param'][k]

								if isinstance(A_	,A_   ):
									A     = 1 if v else 0

								A     = '' if isinstance(A_	,(int, float)   ) else '-'
								A     = F'{key}{sep}{v}'
								name.append(A_   )

							return "_".join(A_   )




						@classmethod
						def     _SCREAMING_SNAKE_CASE   (			cls  :   List[str]	,A_  :   Any   )  -> int:
							A     = repr[len(cls.PREFIX   ) + 1 :]
							if repr == "":
								A     = []
							else:
								A     = repr.split('_'   )

							A     = {}

							for value in values:
								if "-" in value:
									A ,   A     = value.split('-'   )
								else:
									A     = re.sub('[0-9.]'	,''	,A_   )
									A     = float(re.sub('[^0-9.]'	,''	,A_   )   )

								A     = cls.NAMING_INFO['reverse_short_param'][p_k]

								A     = p_v

							for k in cls.DEFAULTS:
								if k not in parameters:
									A     = cls.DEFAULTS[k]

							return parameters