n,m=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
b=[list(map(int,input().split()))for i in range(m)]
for i in a:
  ans=10**18
  for j in b:
    ans=min(ans,abs(i[0]-j[0])+abs(i[1]-j[1]))
  print(ans)