n,m=map(int,input().split())
p=[tuple(map(int,input().split())) for i in range(n)]
for i in range(m):
  c,d=map(int,input().split())
  ans=10**10
  for j,k in p:
    ans=min(ans,abs(c-j)+abs(d-k))
  print(ans)