(let* ((n (read))
       (m (read))
       (stu (loop :for k :from 1 :upto n :collect (list (read) (read))))
       (ckpt (loop :for k :from 1 :upto m :collect (list k (read) (read)))))
  (defun dist (a b)
    (+ (abs (- (first a) (first b))) (abs (- (second a) (second b)))))
  (defun f (k)
    (let* ((ans 1))
      (loop :for x :from 1 :upto m :do(if (> (dist k (cdr (nth (1- ans) ckpt))) (dist k (cdr (nth (1- m) ckpt)))) (setf ans x)))
      ans))
  (mapcar (lambda (j) (format t "~A~%" (f j))) stu))