fun main(args: Array<String>) {
    data class Point(val x: Long, val y: Long)
    data class CheckPoint(val number: Int, val x: Long, val y: Long)

    val (n, m) = readLine()?.split(" ")?.map(String::toInt) ?: return

    val students = mutableListOf<Point>()

    repeat(n) {
        val (a, b) = readLine()?.split(" ")?.map(String::toLong) ?: return
        students.add(Point(a, b))
    }
    val checkPoints = mutableListOf<CheckPoint>()
    repeat(m) {
        val (c, d) = readLine()?.split(" ")?.map(String::toLong) ?: return
        checkPoints.add(CheckPoint(it + 1, c, d))
    }

    buildString {
        students.forEach { student ->
            val min = checkPoints.minBy { checkPoint ->
                Math.abs(student.x - checkPoint.x) + Math.abs(student.y - checkPoint.y)
            }!!
            appendln(min.number)
        }
    }.let {
        println(it)
    }
}
