output_description: For each find operation, print the value.
input_description: n q
      query1
      query2
      :
      queryq
      
  
  In the first line, n (the number of elements in A) and q (the number of
  queries) are given. Then, _i_ th query queryi is given in the following
  format:
  
      
      
      0 s t x 
      
  
  or
  
      
      
      1 i
      
  
  The first digit represents the type of the query. '0' denotes update(s, t, x)
  and '1' denotes find(i).
attempt: #!/usr/bin/env python3
  # DSL_2_D: Range Update Query
  
  
  class SegmentTree:
      def __init__(self, n):
          size = 1
          while size < n:
              size *= 2
          self.size = 2 * size - 1
          self.data = [-1] * self.size
          self.data[0] = 2**31 - 1
  
      def set_range(self, lo, hi, v):
          def _set_range(r, i, j, vv):
              if j < lo or i > hi:
                  if vv != -1:
                      self.data[r] = vv
              elif lo <= i and j <= hi:
                  self.data[r] = v
              else:
                  if self.data[r] != -1:
                      vv = self.data[r]
                      self.data[r] = -1
                  mid = i + (j - i) // 2
                  _set_range(r * 2 + 1, i, mid, vv)
                  _set_range(r * 2 + 2, mid + 1, j, vv)
  
          _set_range(0, 0, self.size // 2, -1)
  
      def get(self, i):
          def _get(r, lo, hi):
              if self.data[r] != -1:
                  return self.data[r]
              mid = lo + (hi - lo) // 2
              if i <= mid:
                  return _get(r * 2 + 1, lo, mid)
              else:
                  return _get(r * 2 + 2, mid + 1, hi)
  
          return _get(0, 0, self.size // 2)
  
  
  def run():
      n, q = [int(x) for x in input().split()]
      t = SegmentTree(n)
  
      for _ in range(q):
          com, *args = [x for x in input().split()]
          if com == "0":
              i, j, v = [int(x) for x in args]
              t.set_range(i, j, v)
          elif com == "1":
              i = int(args[0])
              print(t.get(i))
  
  
  if __name__ == "__main__":
      run()
  
problem_description: Range Update Query (RUQ)
  
  Write a program which manipulates a sequence A = {a0, a1, . . . , an−1} with
  the following operations:
  
    * update(s, t, x): change as, as+1, ..., at to x.
    * find(i): output the value of ai.
  
  Note that the initial values of ai (i = 0, 1, . . . , n−1) are 231-1.
samples: [{"input": "3 5\n    0 0 1 1\n    0 1 2 3\n    0 2 2 2\n    1 0\n    1 1", "output": "1\n    3"}, {"input": "1 3\n    1 0\n    0 0 0 5\n    1 0", "output": "2147483647\n    5"}]