fun main(args: Array<String>) = yorukatsu16b()

fun yorukatsu16b() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val abList = (1..n).map {
        readLine()!!.split(' ').map { it.toInt() }.let { it[0] to it[1] }
    }
    val cdList = (1..m).map {
        it to readLine()!!.split(' ').map { it.toInt() }
    }

    val answer = abList.map { ab ->
        val (a, b) = ab
        cdList.minBy {
            val (index, cd) = it
            val (c, d) = cd
            Math.abs(c - a) + Math.abs(d - b)
        }!!.first
    }.joinToString(System.lineSeparator())

    println(answer)
}
