output_description: For each find operation, print the minimum 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 s t
      
  
  The first digit represents the type of the query. '0' denotes update(s, t, x)
  and '1' denotes find(s, t).
attempt: import sys
  
  readline = sys.stdin.readline
  write = sys.stdout.write
  
  N, Q = map(int, input().split())
  INF = 2**31 - 1
  
  LV = (N - 1).bit_length()
  N0 = 2**LV
  data = [INF] * (2 * N0)
  lazy = [None] * (2 * N0)
  
  
  def gindex(l, r):
      L = (l + N0) >> 1
      R = (r + N0) >> 1
      lc = 0 if l & 1 else (L & -L).bit_length()
      rc = 0 if r & 1 else (R & -R).bit_length()
      for i in range(LV):
          if rc <= i:
              yield R
          if L < R and lc <= i:
              yield L
          L >>= 1
          R >>= 1
  
  
  def propagates(*ids):
      for i in reversed(ids):
          v = lazy[i - 1]
          if v is None:
              continue
          lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v
          lazy[i - 1] = None
  
  
  def update(l, r, x):
      (*ids,) = gindex(l, r)
      propagates(*ids)
  
      L = N0 + l
      R = N0 + r
      while L < R:
          if R & 1:
              R -= 1
              lazy[R - 1] = data[R - 1] = x
          if L & 1:
              lazy[L - 1] = data[L - 1] = x
              L += 1
          L >>= 1
          R >>= 1
      for i in ids:
          data[i - 1] = min(data[2 * i - 1], data[2 * i])
  
  
  def query(l, r):
      propagates(*gindex(l, r))
      L = N0 + l
      R = N0 + r
  
      s = INF
      while L < R:
          if R & 1:
              R -= 1
              s = min(s, data[R - 1])
          if L & 1:
              s = min(s, data[L - 1])
              L += 1
          L >>= 1
          R >>= 1
      return s
  
  
  ans = []
  for q in range(Q):
      t, *cmd = map(int, readline().split())
      if t:
          s, t = cmd
          ans.append(str(query(s, t + 1)))
      else:
          s, t, x = cmd
          update(s, t + 1, x)
  
  write("\n".join(ans))
  write("\n")
  
problem_description: RMQ and 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(s, t): report the minimum element in as, as+1, ..., at.
  
  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 2\n    1 1 2", "output": "1\n    2"}, {"input": "1 3\n    1 0 0\n    0 0 0 5\n    1 0 0", "output": "2147483647\n    5"}]