using System;
using System.Collections.Generic;

namespace atcode {
    class MainClass {
        class Point {
            public int x;
            public int y;
            public Point() {
                x = 0;
                y = 0;
            }
            public double getDistTo(Point p) {
                return (Math.Abs(x - p.x) + Math.Abs(y - p.y));
            }
        };
		static void Main(string[] args) {
            string[] firstLine = Console.ReadLine().Split(' ');
            int studentNum = int.Parse(firstLine[0]);
            int checkPointNum = int.Parse(firstLine[1]);

            if (studentNum < 1 || checkPointNum < 1) return;
            if (studentNum > 50 || checkPointNum > 50) return;

            List<Point> studentPoints = new List<Point>();
            List<Point> checkPoints = new List<Point>();
            for (int i = 0; i < studentNum; i++) {
                string[] line = Console.ReadLine().Split(' ');
                Point p = new Point();
                p.x = int.Parse(line[0]);
                p.y = int.Parse(line[1]);
                studentPoints.Add(p);
            }
			for (int i = 0; i < checkPointNum; i++) {
                string[] line = Console.ReadLine().Split(' ');
				Point p = new Point();
                p.x = int.Parse(line[0]);
                p.y = int.Parse(line[1]);
                checkPoints.Add(p);
            }

            foreach (Point p in studentPoints) {
                double minDist = double.MaxValue;
                int minDistIndex = 1;
                int index = 1;
                foreach (Point p2 in checkPoints) {
                    double dist = p.getDistTo(p2);
                    if (dist < minDist) {
                        minDist = dist;
                        minDistIndex = index;
                    }
                    index++;
                }
                Console.WriteLine(minDist.ToString());
            }
		}
    }
}
