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

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

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

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

modifyArray :: (MArray a e m,Ix i) => a i e -> i -> (e -> e) -> m (a i e)
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix.f >> return arr

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

find :: Int -> Int -> Query
find = \x y arr -> do
    es <- mapM (readArray arr) [x..y]
    print $ minimum es
    return arr