n,m = map(int,input().split())
ab = [[int(x) for x in input().split()] for _ in range(n)]
cd = [[int(x) for x in input().split()] for _ in range(m)]
ls = []

for i in range(n):
    cnt = 10*9
    num = 0
    for j in range(m):
        c = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if c<cnt:
            cnt = c
            num = j+1
    print(cnt)
