


"""simple docstring"""


from __future__ import annotations

import math



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

          if right_element < a or left_element > b:
                return True
          if left_element >= a and right_element <= b:
                lowerCamelCase__           =		val
                if left_element != right_element:
                      lowerCamelCase__           =		val
                      lowerCamelCase__           =		val
                      lowerCamelCase__           =		True
                      lowerCamelCase__           =		True
                return True
          lowerCamelCase__           =		(left_element + right_element) // 2
          self.update(self.left(SCREAMING_SNAKE_CASE__				)							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__				)
          self.update(self.right(SCREAMING_SNAKE_CASE__				)							,     mid + 1							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__				)
          lowerCamelCase__           =		max(
              self.segment_tree[self.left(SCREAMING_SNAKE_CASE__				)]							,     self.segment_tree[self.right(SCREAMING_SNAKE_CASE__				)]				)
          return True
    def      _UpperCamelCase       ( self							:					Union[str, Any]							,     SCREAMING_SNAKE_CASE__							:					int							,     SCREAMING_SNAKE_CASE__							:					Union[str, Any]							,     SCREAMING_SNAKE_CASE__							:					int							,     SCREAMING_SNAKE_CASE__							:					str							,     SCREAMING_SNAKE_CASE__							:					Optional[Any]				):
          if self.flag[idx] is True:
                lowerCamelCase__           =		self.lazy[idx]
                lowerCamelCase__           =		False
                if left_element != right_element:
                      lowerCamelCase__           =		self.lazy[idx]
                      lowerCamelCase__           =		self.lazy[idx]
                      lowerCamelCase__           =		True
                      lowerCamelCase__           =		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]
          lowerCamelCase__           =		(left_element + right_element) // 2
          lowerCamelCase__           =		self.query(self.left(SCREAMING_SNAKE_CASE__				)							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__				)
          lowerCamelCase__           =		self.query(self.right(SCREAMING_SNAKE_CASE__				)							,     mid + 1							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__				)
          return max(SCREAMING_SNAKE_CASE__							,     SCREAMING_SNAKE_CASE__				)


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


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


# A Bipartite Graph is a graph whose vertices can be divided into two independent sets,
# U and V such that every edge (u, v) either connects a vertex from U to V or a vertex
# from V to U. In other words, for every edge (u, v), either u belongs to U and v to V,
# or u belongs to V and v to U. We can also say that there is no edge that connects
# vertices of same set.



def   snake_case						(				_a:     Optional[Any]							)->		Union[str, Any]:
      '''simple docstring'''


      lowerCamelCase__           =		[False] * len(_a							)
      lowerCamelCase__           =		[-1] * len(_a							)

      def dfs(_a:     Any		,   _a:     Optional[int]							):
            lowerCamelCase__           =		True
            lowerCamelCase__           =		c
            for u in graph[v]:
                  if not visited[u]:
                        dfs(_a		,   1 - c							)

      for i in range(len(_a							)							):
            if not visited[i]:
                  dfs(_a		,   0							)

      for i in range(len(_a							)							):
            for j in graph[i]:
                  if color[i] == color[j]:
                        return False

      return True


# Adjacency list of graph
_snake_case          =							{0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 4: []}






print(check_bipartite_dfs(graph))



