import Control.Applicative
import Control.Monad
import Data.Array.IO
import Data.Int

type Query = IOUArray Int32 Int32 -> IO (IOUArray Int32 Int32)

main = do
        [n,q] <- map read.words<$>getLine
        qs    <- replicateM (fromIntegral q) $ inpToQuerys.map read.words<$>getLine
        let initialArray = newArray (0,n-1) (2^31-1) :: IO (IOUArray Int32 Int32)
        foldl (>>=) initialArray qs
        return ()

inpToQuerys :: [Int32] -> Query
inpToQuerys [c,x,y]
    | c == 0 = update x y
    | c == 1 = find x y

update :: Int32 -> Int32 -> Query
update = \i x arr -> writeArray arr i x >> return arr

find :: Int32 -> Int32 -> Query
find = \x y arr -> do
    es <- rangeMinimum x y arr
    print $ es
    return arr

rangeMinimum :: Int32 -> Int32 -> IOUArray Int32 Int32 -> IO Int32
rangeMinimum x y arr = arrMin arr y maxBound x

arrMin :: IOUArray Int32 Int32 -> Int32 -> Int32 -> Int32 -> IO Int32
arrMin arr y acc x
        | y == x = readArray arr x >>= \y' -> return $ min y' acc
        | otherwise = do
            x' <- readArray arr x
            if acc > x' then arrMin arr y x' (x+1)
                        else arrMin arr y acc (x+1)

