program main
	implicit none
    integer N, M, i, j, k, dl
	integer, allocatable :: a(:), b(:), c(:), d(:)
	read(*, *) N, M
	allocate(a(1:N))
	allocate(b(1:N))
	allocate(c(1:M))
	allocate(d(1:M))
	do i = 1, N
		read(*, *) a(i), b(i)
	end do
	do i = 1, M
		read(*, *) c(i), d(i)
	end do
	do i = 1, N
		dl = 5d8
		do j = 1, M
			if(dl > abs(c(j)-a(i)) + abs(d(j)-b(i))) then
				dl = abs(c(j)-a(i)) + abs(d(j)-b(i))
				k = j
			end if
		end do
		write(*, *) k
	end do
end program main