# coding: utf-8
# Your code here!

N, M = map(int, input().split())
std_li = [list(map(int, input().split())) for i in range(N)]
chk_li = [list(map(int, input().split())) for j in range(M)]
dist = 0

for i in range(N):
    ctr = 0
    min_dist = pow(10,8) * 4 + 1
    for j in range(M):
        dist = abs(std_li[i][0] - chk_li[j][0]) + abs(std_li[i][1] - chk_li[j][1])
        print(dist, min_dist)
        if dist < min_dist:
            min_dist = dist
            ctr = j + 1
    print(ctr)