open Printf
open Scanf

module type Monoid = sig
    type t
    val append : t -> t -> t
    val default : t
end

module Segtree(M : Monoid) = struct
    type elt = M.t
    type t = Leaf of elt | Node of t * elt * t * int

    let value_of = function
        | Leaf x -> x
        | Node(_, x, _, _) -> x

    let size = function
        | Leaf _ -> 1
        | Node(_, _, _, n) -> n

    let rec range_query a b = function
        | Leaf x -> if a <= 0 && 1 <= b then x else M.default
        | Node(lch, x, rch, n) ->
                if a <= 0 && n <= b then x
                else if b <= 0 || n <= a then M.default
                else
                    let l_size = size lch in
                    M.append (range_query a b lch) (range_query (a - l_size) (b - l_size) rch)

    let rec updated k x = function
        | Leaf _ -> Leaf x
        | Node(lch, _, rch, n) ->
                if k < size lch then
                    let new_lch = updated k x lch in
                    Node(new_lch, M.append (value_of new_lch) (value_of rch), rch, n)
                else
                    let new_rch = updated (k - size lch) x rch in
                    Node(lch, M.append (value_of lch) (value_of new_rch), new_rch, n)

    let rec build n =
        if n <= 1 then Leaf M.default
        else Node(build (n / 2), M.default, build (n - n / 2), n)
end

module RMQ = Segtree(
    struct
        type t = int
        let append = min
        let default = int_of_float (2. ** 31.) - 1
    end)

let _ = scanf "%d %d\n" (fun n q ->
    let rec loop tree = function
        | 0 -> ()
        | i -> scanf "%d %d %d\n" (fun com x y ->
                if com = 0 then loop (RMQ.updated x y tree) (i - 1)
                else begin
                    printf "%d\n" (RMQ.range_query x (y + 1) tree);
                    loop tree (i - 1)
                end) in
    loop (RMQ.build n) q)