fun main() {
    var input = readIntList()
    val n = input[0]
    val m = input[1]
    val students = arrayListOf<Point>()
    for (i in 1..n) {
        input = readIntList()
        students.add(Point(input[0], input[1]));
    }

    val checkPoints = arrayListOf<Point>()
    for (i in 1..m) {
        input = readIntList()
        checkPoints.add(Point(input[0], input[1]));
    }

    for (i in 0 until n) {
        var minIndex = 0;
        var minManhattan = Int.MAX_VALUE;
        for (j in 0 until m) {
            val manhattan = Math.abs(students[i].x - checkPoints[j].x) + Math.abs(students[i].y - checkPoints[j].y);
            if (manhattan < minManhattan) {
                minManhattan = manhattan;
                minIndex = j;
            }
        }
        println(minIndex + 1);
    }
}

data class Point(val x: Int, val y: Int)

fun readIntList() = readLine()!!.split(" ").map(String::toInt)
