read n m;
a=(`dd`);
for((i=0;i<n;i++))do
	k=0;
	s=1000000000;
	x=${a[$[i*2]]};
	y=${a[$[i*2+1]]};
	for((j=n;j<n+m;j++))do
		z=${a[$[j*2]]};
		w=${a[$[j*2+1]]};
		t=$[(x>z?x-z:x-z)+(y>w?y-w:w-y)];
		if [ $t -lt $s ];then
			s=$t;
			k=$[j-n+1];
		fi
	done
	echo $k
done
