class RMQ
  DEFAULT_VALUE = 2**31 - 1
  def initialize
    @array = []
  end

  def find(x, y)
    @array.each do |h|
      if x <= h[:index] && h[:index] <= y
        puts h[:value]
        return
      end
    end
    puts DEFAULT_VALUE
  end

  def update(x, y)
    h = @array.find { |h| h[:index] == x }
    h ? h[:value] = y : @array << { index: x, value: y }
    @array.sort_by! { |h| h[:value] }
  end
end

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

