fun main(args: Array<String>) {
    val (n,m)= readLine()!!.split(" ").map { it.toInt() }
    val a = (1..n).map { readLine()!!.split(" ").map { it.toInt()-1 } }
    val p = (1..m).map { readLine()!!.split(" ").map { it.toInt()-1 } }


    val dist = Array(n){ IntArray(m) }
    for(ai in a.indices)for(pi in p.indices){
        dist[ai][pi]= Math.abs(a[ai][0]-p[pi][0]) + Math.abs(a[ai][1]-p[pi][1])
    }

    dist.forEach {
        val min = it.min()
        val ans = it.indexOfFirst { it==min }
        println(ans+1)
    }

}