fun main(arr: Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val students = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }
    val checkpoints = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }
    val ans = students.map { s-> getPoint(s, checkpoints) + 1 }
    ans.forEach { println(it) }
}

fun getPoint(pos:List<Int>, checkpoints:List<List<Int>>):Int {
    val diff = checkpoints.map { Math.abs(pos[0]-it[0]) + Math.abs(pos[1] - it[1]) }
    val ans = diff.indices.filter { diff[it] == diff.min()!! }.first()
    return ans
}