n = gets.to_i
qx = []
qy = []
i = 0
n.times{
  qx[i], qy[i] = gets.split.map(&:to_i)
  i += 1
}

q = gets.to_i
q.times{
  sx, tx, sy, ty = gets.split.map(&:to_i)
  n.times{|j|
    next if qx[j] < sx || tx < qx[j] || qy[j] < sy || ty < qy[j]
    puts j
  }
  puts
}