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: from math import log2, ceil
  
  
  class SegmentTree:
      def __init__(self, n):
          tn = 2 ** ceil(log2(n))
          self.a = [2**31 - 1] * (tn * 2)
  
      def find(self, c, l, r, i):
          if self.a[c] != -1:
              return self.a[c]
          mid = (l + r) // 2
          if i <= mid:
              return self.find(c * 2, l, mid, i)
          else:
              return self.find(c * 2 + 1, mid + 1, r, i)
  
      def update(self, c, l, r, s, t, x):
          if l == s and r == t:
              self.a[c] = x
              return
          cv = self.a[c]
          if cv != -1:
              self.a[c * 2] = self.a[c * 2 + 1] = cv
              self.a[c] = -1
          mid = (l + r) // 2
          if t <= mid:
              self.update(c * 2, l, mid, s, t, x)
          elif s > mid:
              self.update(c * 2 + 1, mid + 1, r, s, t, x)
          else:
              self.update(c * 2, l, mid, s, mid, x)
              self.update(c * 2 + 1, mid + 1, r, mid + 1, t, x)
  
  
  n, q = map(int, input().split())
  st = SegmentTree(n)
  for _ in range(q):
      query = input().split()
      if query[0] == "0":
          s, t, x = map(int, query[1:])
          st.update(1, 0, n - 1, s, t, x)
      else:
          print(st.find(1, 0, n - 1, int(query[1])))
  
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"}]