n, q = gets.split.map(&:to_i)
b = Math.sqrt(n).floor

a = Array.new(n){2**31-1}
ba = Array.new(n/b){2**31-1}

q.times{
  com, x, y = gets.split.map(&:to_i)
  case com
  when 0
    a[x] = y
    min = 2**31-1
    (x/b*b).upto(x/b*b+b-1){|j|
      min = a[j] if min > a[j]
    }
    ba[x/b] = min
  when 1
    # p "a #{a}"
    # p "ba #{ba}"
    min = 2**31-1
    bx = x / b
    by = y / b
    min = 2**31-1
    # p "#{x} #{bx*b+b-1}"
    x.upto(bx*b+b-1){|j|
      min = a[j] if min > a[j]
    }
    (bx+1).upto(by-1){|j|
      min = ba[j] if min > ba[j]
    }
    # p "#{by*b} #{y}"
    (by*b).upto(y){|j|
      min = a[j] if min > a[j]
    }
    p min
  end
}