n,m=io.read("*n","*n")
a={}
for i=1,n do
    a[i]={}
    a[i][1],a[i][2]=io.read("*n","*n")
end
c={}
for i=1,m do
    c[i]={}
    c[i][1],c[i][2]=io.read("*n","*n")
end

checkpoint={}
for i=1,n do
    min={2000000000000001,51}
    for j=1,m do
        manhattan=math.abs(a[i][1]-c[j][1])+math.abs(a[i][2]-c[j][2])
        if min[1]>manhattan then
            min[1],min[2]=manhattan,j
        end
    end
    table.insert(checkpoint,min)
end

for i=1,n do
    print(checkpoint[i][2])
end