n,m = map(int,input().split())
A = [], B = []
ans = 0
temp = 0
for i in range(n):
  x,y = map(int,input().split())
  A.append(x)
  B.append(y)
  for j in range(m):
    x,y = map(int,input().split())
    if m == 0:
      temp = abs(A[i] - x) + abs(B[i] - y)
      ans = 0
    elif abs(A[i] - x) + abs(B[i] - y) < temp:
      temp = abs(A[i] - x) + abs(B[i] - y)
      ans = j
  print(ans)
