# ABC057 B - Checkpoints
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n,m = nm()

AB = []
CD = []
ans = 10**10
for i in range(n):
    a,b = nm()
    AB.append(a)
    AB.append(b)

for i in range(m):
    c,d = nm()
    CD.append(c)
    CD.append(d)

for i in range(n):
    for j in range(m):
        ans = min(ans,abs(AB[0]-CD[0])+abs(AB[1]-CD[1]))
    print(ans)