fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }
    val P = (0 until x).map{readLine()!!.split(" ").map { it.toInt() }}
    val S =  (0 until y).map{readLine()!!.split(" ").map { it.toInt() }}
    var md = mutableListOf<Int>()
    S.forEachIndexed{si,z ->
        md = emptyList<Int>().toMutableList()
        P.forEachIndexed {pi,zz ->
            md.add(Math.abs(S[pi][0] - P[si][0]) + Math.abs(S[pi][1] - P[si][1]))
        }
        println(md.indexOf(md.min()) + 1)
    }
}