class Bucket
  INF = 2 ** 31 - 1

  def initialize(n)
    @arr = Array.new(n){ INF }
    bucket_size = Math.sqrt(n).ceil
    @bucket = Array.new(bucket_size) { INF }
  end

  def update(i, val)
    @arr[i] = val
    bucket_idx = to_bucket_idx(i)
    @bucket[bucket_idx] = val if val < @bucket[bucket_idx]
  end

  def query(i, j)
    i_bucket_idx = to_bucket_idx(i)
    j_bucket_idx = to_bucket_idx(j)

    return find_min(@arr, i, j) if (j_bucket_idx - i_bucket_idx) <= 2

    val = []
    val << find_min(@arr, i, (i_bucket_idx + 1) * @bucket.size - 1)
    val << find_min(@arr, (j_bucket_idx - 1) * @bucket.size, j)
    val << find_min(@bucket, i_bucket_idx + 1, j_bucket_idx - 1)

    val.min
  end

  private

  def find_min(arr, start_idx, end_idx)
    min = arr[start_idx]
    (start_idx..end_idx).each{|i| min = arr[i] if arr[i] < min }
    min
  end

  def to_bucket_idx(i)
    i / @bucket.size
  end
end

n, q = gets.split.map(&:to_i)
b = Bucket.new(n)

q.times do
  com, x, y = gets.split.map(&:to_i)

  case com
  when 0
    b.update(x, y)
  when 1
    puts b.query(x, y)
  end
end