MAX = 2**31-1
n, q = gets.split.map(&:to_i)
b = Math.sqrt(n).floor
a = Array.new(n){MAX}
ba = []
n.times{|i|
  j = i / b
  ba[j] = MAX
}

q.times{
  com, x, y = gets.split.map(&:to_i)
  if com == 1 then
    xb = x / b
    yb = y / b
    min = [MAX, MAX, MAX]
    min[0] = ba[xb+1..yb-1].min if xb + 1 <= yb-1
    min[1] = a[x..xb+b-1].min
    min[2] = a[yb*b..y].min
    p min.min
  else
    a[x] = y
    j = x / b
    s = j * b
    e = j * b + b
    ba[j] = a[s..e].min
  end
}