import java.util.*;

object MainKt {
  @JvmStatic fun main(args:Array<String>) {
    val (N,M)=readLine()!!.split(" ").map {it.toInt()}
    val student=(1..N).map {
      val (a,b)=readLine()!!.split(" ").map {it.toInt()}
      Triple(it,a,b)
      }
    val check=(1..M).map {
      val (c,d)=readLine()!!.split(" ").map {it.toInt()}
      Triple(it,c,d)
      }
    student.map{s->
    val d=check.minBy {Math.abs(s.second-it.second)+Math.abs(s.third-it.third)}!!
    check.filter {
      (Math.abs(s.second-it.second)+Math.abs(s.third-it.third))==(Math.abs(s.second-d.second)+Math.abs(s.third-d.third))
    }.minBy {it.first}!!
    }.forEach {
      println("${it.first}")
    }
  }
}