fun main(args: Array<String>) = println(run {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val students = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }
    val checkpoint = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }

    students.map { ab ->
        val (a,b) = ab
        checkpoint.withIndex().minBy { cd ->
            val (c,d) = cd.value
            Math.abs(a-c) + Math.abs(b-d)
        }!!.index + 1
    }.joinToString("\n")

})
