



"""simple docstring"""







from __future__ import annotations

import math
class        __A       :







		'''simple docstring'''





		def __init__(	self						:  Optional[int]			,_snake_case						:  int						)					->		None:






				"""simple docstring"""



				lowercase__   :    str				=			size
				# approximate the overall size of segment tree with given value
				lowercase__   :    Optional[Any]				=			[0 for i in range(0			,4 * size						)]
				# create array to store lazy update
				lowercase__   :    Optional[int]				=			[0 for i in range(0			,4 * size						)]
				lowercase__   :    Optional[Any]				=			[0 for i in range(0			,4 * size						)]  # flag for lazy update







		def 					UpperCAmelCase    (	self						:  Optional[int]			,_snake_case						:  int						)					->		int:






				"""simple docstring"""



				return idx * 2







		def 					UpperCAmelCase    (	self						:  Optional[int]			,_snake_case						:  int						)					->		int:






				"""simple docstring"""



				return idx * 2 + 1







		def 					UpperCAmelCase    (	self						:  List[Any]			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  list[int]						)					->		None:






				"""simple docstring"""



				if left_element == right_element:
						lowercase__   :    List[str]				=			a[left_element - 1]
				else:
						lowercase__   :    Dict				=			(left_element + right_element) // 2
						self.build(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case						)
						self.build(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case						)
						lowercase__   :    Tuple				=			max(
						    self.segment_tree[self.left(_snake_case						)]			,self.segment_tree[self.right(_snake_case						)]						)







		def 					UpperCAmelCase    (	self						:  Union[str, Any]			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int						)					->		bool:






				"""simple docstring"""



				if self.flag[idx] is True:
						lowercase__   :    Optional[int]				=			self.lazy[idx]
						lowercase__   :    Tuple				=			False
						if left_element != right_element:
								lowercase__   :    Any				=			self.lazy[idx]
								lowercase__   :    Union[str, Any]				=			self.lazy[idx]
								lowercase__   :    List[Any]				=			True
								lowercase__   :    Dict				=			True

				if right_element < a or left_element > b:
						return True
				if left_element >= a and right_element <= b:
						lowercase__   :    Tuple				=			val
						if left_element != right_element:
								lowercase__   :    Any				=			val
								lowercase__   :    int				=			val
								lowercase__   :    List[str]				=			True
								lowercase__   :    Optional[int]				=			True
						return True
				lowercase__   :    Tuple				=			(left_element + right_element) // 2
				self.update(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				self.update(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				lowercase__   :    int				=			max(
				    self.segment_tree[self.left(_snake_case						)]			,self.segment_tree[self.right(_snake_case						)]						)
				return True







		def 					UpperCAmelCase    (	self						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int			,_snake_case						:  int						)					->		int | float:






				"""simple docstring"""



				if self.flag[idx] is True:
						lowercase__   :    int				=			self.lazy[idx]
						lowercase__   :    Optional[Any]				=			False
						if left_element != right_element:
								lowercase__   :    Optional[Any]				=			self.lazy[idx]
								lowercase__   :    List[Any]				=			self.lazy[idx]
								lowercase__   :    Any				=			True
								lowercase__   :    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]
				lowercase__   :    Optional[int]				=			(left_element + right_element) // 2
				lowercase__   :    str				=			self.query(self.left(_snake_case						)			,_snake_case			,_snake_case			,_snake_case			,_snake_case						)
				lowercase__   :    List[Any]				=			self.query(self.right(_snake_case						)			,mid + 1			,_snake_case			,_snake_case			,_snake_case						)
				return max(_snake_case			,_snake_case						)







		def __str__(	self						:  str						)					->		str:






				"""simple docstring"""



				return str([self.query(1			,1			,self.size			,_snake_case			,_snake_case						) for i in range(1			,self.size + 1						)]						)


if __name__ == "__main__":
							lowerCAmelCase_   						=   [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
							lowerCAmelCase_   						=   15
							lowerCAmelCase_   						=   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"""







def      __UpperCAmelCase      (    __lowerCamelCase						,     __lowerCamelCase	)							->      str:
		if not isinstance(__lowerCamelCase						,     __lowerCamelCase	):
				raise ValueError('''iterations must be defined as integers'''	)
		if not isinstance(__lowerCamelCase						,     __lowerCamelCase	) or not number >= 1:
				raise ValueError(
				    '''starting number must be
                         and integer and be more than 0'''	)
		if not iterations >= 1:
				raise ValueError('''Iterations must be done more than 0 times to play FizzBuzz'''	)

		lowercase__   :    Tuple				=			''''''
		while number <= iterations:
				if number % 3 == 0:
						out += "Fizz"
				if number % 5 == 0:
						out += "Buzz"
				if 0 not in (number % 3, number % 5):
						out += str(__lowerCamelCase	)

				# print(out)
				number += 1
				out += " "
		return out


if __name__ == "__main__":
							import doctest

							doctest.testmod()
