def update(s, t, x, l, r, k)
  if s == l && t == r then
    $d[k] = x
  else
    if $d[k] > 0 then
      $d[2*k+1] = $d[2*k+2] = $d[k]
      $d[k] = -1
    end
    m = (l + r)/2
    if t <= m then
      update(s, t, x, l, m, 2*k+1)
    elsif m <= s then
      update(s, t, x, m, r, 2*k+2)
    else
      update(s, m, x, l, m, 2*k+1)
      update(m, t, x, m, r, 2*k+2)
    end
  end
end

def find(i, l, r, k)
  return $d[k] if $d[k] > 0
  m = (l+r)/2
  if i < m then
    return find(i, l, m, 2*k+1)
  else
    return find(i, m, r, 2*k+2)
  end
end

MAX = 2**31-1
n, q = gets.split.map(&:to_i)

m = 1
while m < n
  m *= 2
end

$d = Array.new(2*m-1){MAX}

q.times{
  com, s, t, x = gets.split.map(&:to_i)
  case com
  when 0
    update(s, t+1, x, 0, m, 0)
  when 1
    p find(s, 0, m, 0)
  end
}