#!/usr/local/gnu/bin/bash
read n m
a=()
b=()
c=()
d=()
for i in `seq $n`
do
    read x y
    a[$i]=$x
    b[$i]=$y
done
for i in `seq $m`
do
    read x y
    c[$i]=$x
    d[$i]=$y
done
for i in `seq $n`
do
    min=1000000000
    minId=0
    for j in `seq $m`
    do
        ((c[j]>a[i])) && e=$((c[j]-a[i])) || e=$((a[i]-c[j]))
        ((d[j]>b[i])) && e=$((e+d[j]-b[i])) || e=$((e+b[i]-d[j]))
        ((e<min)) && min=$e && minId=$j
    done
    echo $minId
done
