n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
  A.append(list(map(int,input().split())))
for i in range(m):
  B.append(list(map(int,input().split())))

for i in A:
  man=1000000000
  for j in B:
    man=min(man,abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(man)