INF = (1 << 31) - 1
def init
  x = 1
  while x < $n
    x <<= 1
  end
  $n = x
  $arr = Array.new(2*x-1, INF)
end

def update(i, x)
  i += $n - 1
  $arr[i] = x
  while i > 0
    i = (i - 1) / 2
    $arr[i] = $arr[i*2+1,2].min
  end
end

def query(a,b,k,l,r)
  if r <= a || b <= l then return INF
  end
  if a <= l && r <= b then return $arr[k]
  else
    vl = query(a, b, k*2+1, l, (l+r) / 2)
    vr = query(a, b, k*2+2, (l+r) / 2, r)
    return [vl, vr].min
  end
end

$n, q = gets.split.map(&:to_i)
init
q.times do
  cmd, x, y = gets.split.map(&:to_i)
  if cmd == 0 then update(x, y)
  else puts query(x, y+1, 0, 0, $n)
  end
end