open Printf
open Scanf

let () =
  let n, q = scanf "%d %d " (fun a b -> (a, b)) in
  let b = 300 in
  let iv = max_int in
  (* let iv = 2147483647 in *)
  let ar = Array.make n iv in
  let ubk = Array.make ((n + b - 1) / b) None in
  let mbk = Array.make ((n + b - 1) / b) iv in
  let wb i = match ubk.(i) with
      None -> ()
    | Some v -> let rec iter j =
                  if j = b then ubk.(i) <- None
                  else begin
                      ar.(i*b+j) <- v;
                      iter (j+1)
                    end in
                iter 0;
                mbk.(i) <- v
  in
  let update s t x =
    let rec iter i =
      if i >= t then ()
      else
        if i mod b = 0 && i + b <= t then
          begin
            ubk.(i / b) <- Some x;
            mbk.(i / b) <- x;
            iter (i + b)
          end
        else
          begin
            (match ubk.(i / b) with
               None -> ()
             | Some _ -> wb (i / b));
            ar.(i) <- x;
            mbk.(i / b) <- min mbk.(i / b) x;
            iter (i + 1)
          end
    in iter s
  in
  let find s t =
    let rec iter i m =
      if i >= t then m
      else
        if i mod b = 0 && i + b <= t then
          iter (i + b) (min m mbk.(i / b))
        else
          iter (i + 1) (min m ar.(i))
    in
    iter s iv
  in
  let rec loop c =
    if c = 0 then ()
    else
      begin
        (let com = scanf "%d " (fun u -> u) in
        if com = 0 then
          let s, t, x = scanf "%d %d %d " (fun u v w -> (u, v+1, w)) in
          update s t x
        else
          let s, t = scanf "%d %d " (fun u v -> (u, v+1)) in
          find s t |> printf "%d\n");
        loop (c - 1)
      end
  in
  loop q