class RMQ
  INFINITY = 2**31 - 1
  def initialize(size)
    @index = 1
    @index *= 2 while @index < size
    @array = Array.new(@index * 2 - 1, INFINITY)
  end

  def find(x, y, k = 0, l = 0, r = @index)
    if r <= x || y <= l
      INFINITY
    elsif x <= l && r <= y
      @array[k]
    else
      ml = find(x, y, k * 2 + 1, l, (l + r) / 2)
      mr = find(x, y, k * 2 + 2, (l + r) / 2, r)
      [ml, mr].min
    end
  end

  def update(x, y)
    x += @index - 1
    @array[x] = y
    while x > 0
      x = (x - 1) / 2
      @array[x] = @array[(x * 2) + 1, 2].min
    end
  end
end

n, q = gets.split.map(&:to_i)
rmq = RMQ.new(n)
q.times do
  com, x, y = gets.split.map(&:to_i)
  com == 0 ? rmq.update(x, y) : puts(rmq.find(x, y + 1))
end

