{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Control.Monad.Primitive
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector.Generic as VG
import qualified Data.Vector.Generic.Mutable as VGM
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Bits
import Data.Int
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]]


  let inf = 2147483647

  seg <- newSegmentTree n inf min :: IO (IOUSegmentTree Int)

  forM_ queries $ \[com,x,y] -> do
    when (com == 0) $ do
      modifySegmentTree seg x (const y)
    when (com == 1) $ do
      print =<< findSegmentTree seg x (y+1)



{-- 点更新・範囲取得のセグメント木 --}
type MSegmentTree v s a = (v s a, a, (a -> a -> a)) -- (セグメント木, 単位元, 二項演算)
type STSegmentTree s a = MSegmentTree VM.MVector s a
type IOSegmentTree a = STSegmentTree RealWorld a
type STUSegmentTree s a = MSegmentTree VUM.MVector s a
type IOUSegmentTree a = STUSegmentTree RealWorld a

newSegmentTree :: (Applicative m, PrimMonad m, VGM.MVector v a) => Int -> a -> (a -> a -> a) -> m (MSegmentTree v (PrimState m) a)
newSegmentTree n e f = (,e,f) <$> (VGM.replicate m e)
  where m = 2 * (2 ^ (ceiling $ logBase 2 (fromIntegral n))) - 1

modifySegmentTree :: (Applicative m, PrimMonad m, VGM.MVector v a) => MSegmentTree v (PrimState m) a -> Int -> (a -> a) -> m ()
modifySegmentTree (tree,e,f) i g = do
  VGM.write tree j =<< return . g =<< VGM.read tree j
  aux ((j-1)`div`2)
  where
    n = (VGM.length tree) `div` 2 + 1
    j = i + n - 1
    aux i = do
      when (i >= 0) $ do
        VGM.write tree i =<< f <$> VGM.read tree (i*2+1) <*> VGM.read tree (i*2+2)
        aux ((i-1)`div`2)
        
findSegmentTree :: (Applicative m, PrimMonad m, VGM.MVector v a) => MSegmentTree v (PrimState m) a -> Int -> Int -> m a
findSegmentTree (tree,e,f) x y = do
  aux 0 0 n
  where
    n = (VGM.length tree) `div` 2 + 1
    aux i l r
      | r <= x || y <= l = return e
      | x <= l && r <= y = VGM.read tree i
      | otherwise = f <$> aux (i*2+1) l ((l+r)`div`2) <*> aux (i*2+2) ((l+r)`div`2) r

