Option Infer On
Imports System.Collections.Generic
Imports System.Console
Imports System.Math

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim M As Integer = NextInt()

        Dim students = New Integer(N - 1, 1) {}
        Dim checkPoints = New Integer(M - 1, 1) {}

        For i = 0 To N - 1
            students(i, 0) = NextInt()
            students(i, 1) = NextInt()
        Next

        For j = 0 To M - 1
            checkPoints(j, 0) = NextInt()
            checkPoints(j, 1) = NextInt()
        Next

        For i = 0 To N - 1
            Dim index = -1
            Dim value = Integer.MaxValue
            For j = 0 To M - 1
                Dim x1 = students(i, 0)
                Dim y1 = students(i, 1)
                Dim x2 = checkPoints(j, 0)
                Dim y2 = checkPoints(j, 1)
                Dim Calc_result = Calc(x1, x2, y1, y2)

                If Calc_result < value Then
                    index = j
                    value = Calc_result
                End If
            Next
            WriteLine(index + 1)
        Next
    End Sub

    Function Calc(x1 As Integer, x2 As Integer,
                  y1 As Integer, y2 As Integer) As Integer
        Return Abs(x1 - x2) + Abs(y1 - y2)
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module
