import io.StdIn._
object Main extends App {
    val Array(n, m) = readLine.split(" ").map(_.toInt)
    val abs = for(count <- 1 to n) yield readLine.split(" ").map(_.toLong)
    val cds = for(count <- 1 to m) yield readLine.split(" ").map(_.toLong)

    for(ab <- abs) {
        val manhattans = cds.map(cd => (ab.head - cd.head).abs + (ab.last - cd.last).abs)
        val min = manhattans.min
        val index = manhattans.indexOf(min)
        println(index+1)
    }
}