using System;

class P
{
    static void Main(string[] _)
    {
        _ = Console.ReadLine().Split(' ');
        int n = int.Parse(_[0]);
        int m = int.Parse(_[1]);
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++)
        {
            _ = Console.ReadLine().Split(' ');
            a[i] = int.Parse(_[0]);
            b[i] = int.Parse(_[1]);
        }

        int[] c = new int[m];
        int[] d = new int[m];
        for (int i = 0; i < m; i++)
        {
            _ = Console.ReadLine().Split(' ');
            c[i] = int.Parse(_[0]);
            d[i] = int.Parse(_[1]);
        }
        
        for (int i = 0; i < n; i++)
        {
            int min = int.MaxValue;
            for (int j = 0; j < m; j++)
            {
                min = Math.Min(min, Math.Abs(a[i] - c[j]) + Math.Abs(b[i] - d[j]));
            }
            Console.WriteLine(min);
        }
    }
}
