A = list(map(int,input().split(" ")))
H = list()
C = list()
result = list()
for i in range(A[0]):
    H.append(list(map(int,input().split(" "))))
for i in range(A[1]):
    C.append(list(map(int,input().split(" "))))
    
for i in range(A[0]):
    res = 0
    tmp = 99999999
    for ii in range(A[1]):
        if tmp > abs(H[i*2-1] - C[i*2-1]) + abs(H[i*2] - C[i*2]):
            res = ii
    result.append(res)

for i in range(A[1]):
    print(result[i])
