<?php
list($n, $m) = explode(" ", trim(fgets(STDIN)));
for($i = 0; $i < $n; $i++){
    $from[] = explode(" ", trim(fgets(STDIN)));
}
for($i = 0; $i < $m; $i++){
    $to[] = explode(" ", trim(fgets(STDIN)));
}
foreach($from as $f){
    $minDist = 10**18;
    $p = -1;
    foreach($to as $i => $t){
        $dist = ($t[0] - $f[0])**2 + ($t[1] - $f[1])**2;
        if($dist < $minDist){
            $minDist = $dist;
            $p = $i;
        }
    }
    echo ($p+1),"\n";
}
