import Control.Monad.State
data SegTree a = Leaf a
               | Elem Int a
               | Tree Int a (SegTree a) (SegTree a)
               deriving (Show)

main = do
    [n,q] <- map read.words<$>getLine
    let init = Elem n (2^31-1)
    evalStateT (query q) init

size (Leaf a) = 1
size (Elem n _) = n
size (Tree n _ _ _) = n

value (Leaf v) = v
value (Elem _ v) = v
value (Tree _ v _ _) = v

left (Elem n v)
  | n == 2 = Leaf v
  | n == 3 = Leaf v
  | otherwise = let n' = n `div` 2 in Elem n' v
left (Tree _ _ l _) = l
right (Elem n v)
  | n == 2 = Leaf v
  | otherwise = let n' = n `div` 2 in Elem (n-n') v
right (Tree _ _ _ r) = r

fromList xs = fl n xs
    where n = length xs

fl n xs = Tree n' m leftT rightT
    where n' = n `div` 2
          (xsL, xsR) = splitAt n' xs
          leftT = fl n' xsL
          rightT = fl n' xsR
          m = min (value leftT) (value rightT)

updateT s t x (Leaf v) = (Leaf x)
updateT s t x tr
  | n <= s = let lt = left tr
                 rt = updateT (s-n) (t-n) x (right tr)
                 m = min (value lt) (value rt)
              in Tree (size tr) m lt rt
  | n > t  = let lt = updateT s t x (left tr)
                 rt = right tr
                 m  = min (value lt) (value rt)
              in Tree (size tr) m lt rt
  | t-s+1 == size tr = Elem (size tr) x
  | otherwise = let lt = updateT s n x (left tr)
                    rt = updateT 0 (t-n) x (right tr)
                    m  = min (value lt) (value rt)
                 in Tree (size tr) m lt rt
  where n = size tr `div` 2

findT :: Ord a => Int -> Int -> SegTree a -> a
findT s t tr
  | n <= s = findT (s-n) (t-n) (right tr)
  | n > t  = findT s t (left tr)
  | t-s+1 == size tr = value tr
  | otherwise = min (findT s n (left tr)) (findT 0 (t-n) (right tr))
  where n = size tr `div` 2


query :: Int -> StateT (SegTree Int) IO ()
query 0 = return ()
query n = getQuery >> query (n-1)

getQuery :: StateT (SegTree Int) IO ()
getQuery = do
    (x:xs) <- lift $ map read.words<$>getLine
    case x of
      0 -> let [s,t,x] = xs in modify (updateT s t x)
      1 -> let [s,t] = xs in get >>= \tr -> lift $ print $ findT s t tr
      3 -> get >>= \tr -> lift $ print tr

