import java.util.*

fun main(args:Array<String>):Unit {
    val (n, t, q) = readLine()!!.trim().split(' ').map(String::toLong)
    val civils = List(n.toInt()){val (a, b) = readLine()!!.trim().split(' ').map(String::toLong)
        Pair(a, b)
    }.toTypedArray()
    val stack = Stack<Long>()
    for (i in 1 until civils.size){
        if (civils[i - 1].second == 1L && civils[i].second == 2L){
            stack.push((civils[i - 1].first + civils[i].first) / 2)
        }
    }
    val stopPos = stack.toLongArray()
    repeat(q.toInt()){
        val pos = civils[readLine()!!.trim().toInt() - 1]
        val idx = -stopPos.binarySearch(pos.first) - 1
        when(pos.second){
            1L -> if (idx == stopPos.size || pos.first + t < stopPos[idx] ){
                println(pos.first + t)
            }else{
                println(stopPos[idx])
            }
            else -> if (idx <= 0 || pos.first - t > stopPos[idx - 1]){
                println(pos.first - t)
            }else{
                println(stopPos[idx - 1])
            }
        }
    }
}
