{-# LANGUAGE FlexibleContexts #-}

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Bits
import Debug.Trace

main = do
  [n,q] <- map read . words <$> getLine :: IO [Int]
  queries <- replicateM q $ map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine :: IO [[Int]]



  seg <- stToIO $ newSegmentTree n (maxBound::Int) :: IO (IOSegmentTree Int)

  forM_ queries $ \[com,x,y] -> do
    when (com == 0) $ do
      stToIO $ updateSegmentTree seg x y min
    when (com == 1) $ do
      a <- stToIO $ findSegmentTree seg x (y+1) (maxBound::Int) min
      print a


type STSegmentTree s a = VM.MVector s a
type IOSegmentTree a = STSegmentTree RealWorld a

newSegmentTree :: Num a => Int -> a ->  ST s (STSegmentTree s a)
newSegmentTree n x = V.thaw $ V.replicate (((bit m)*2-1 :: Int)) x
  where m = (length . takeWhile (/=0). iterate ((flip shiftR) 1)) n


updateSegmentTree :: Num a => STSegmentTree s a -> Int -> a -> (a -> a -> a) -> ST s ()
updateSegmentTree tree i x f = do
  let n = (VM.length tree + 1) `div` 2
  VM.write tree (i+n-1) x
  aux (i+n-1) x
  where
    aux i x = do
      when (i >= 0) $ do
        a <- VM.read tree i
        VM.write tree i (f a x)
        aux ((i-1)`div`2) x
      

findSegmentTree :: Num a => STSegmentTree s a -> Int -> Int -> a -> (a -> a -> a) -> ST s a
findSegmentTree tree x y e f = do
  let n = (VM.length tree + 1) `div` 2
  aux 0 0 n

  where
    aux i l r
      | r <= x || y <= l = return e
      | x <= l && r <= y = VM.read tree i
      | otherwise = f <$> aux (i*2+1) l ((l+r)`div`2) <*> aux (i*2+2) ((l+r)`div`2) r

