import Data.IntMap ((!))
import qualified Data.IntMap.Strict as M
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Maybe
import Control.Applicative

main = do
 [n,_] <- map read . words <$> getLine
 cxys <- map ((\[c,x,y]->(c,(x,y))) . map (fst . fromJust . B.readInt) . B.words) . B.lines <$> B.getContents
 mapM_ print (rmq n cxys)

rmq :: Int -> [(Int,(Int,Int))] -> [Int]
rmq n = reverse . fst . foldl' process ([], ([], M.empty))

process (lg,(r,m)) (c,(x,y))
 | c==0 = (lg, (x:r, M.insert x y m))
 | c==1 = (minimum (2^31-1 : map (m!) (intersect [x..y] r)) : lg, (r,m))