poop=input().split()
kpop=int(poop[0])
jpop=int(poop[1])
lop=[]
jop=[]
for i in range(kpop):
    lop.append(input().split())
for i in range(jpop):
    jop.append(input().split())
for i in range(kpop):
    k=999999999999999
    z=0
    for j in range(jpop):
        if k>abs(int(kpop[i][1])-int(jpop[j][1]))+abs(int(kpop[i][2])-int(jpop[j][2])):
            z=j
            k=abs(int(kpop[i][1])-int(jpop[j][1]))+abs(int(kpop[i][2])-int(jpop[j][2]))
    print(z)
    