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

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

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

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

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)