using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

class Program{
  public static void Main(){

    var nm = Console.ReadLine().Split();
    int n = int.Parse(nm[0]);
    int m = int.Parse(nm[1]);
    
    int[] a = new int[n];
    int[] b = new int[n];
    int[] c = new int[m];
    int[] d = new int[m];
    
    for(int i=0; i<n; i++){
      var ab = Console.ReadLine().Split();
      a[i] = int.Parse(ab[i]);
      b[i] = int.Parse(ab[i]);
    }
    for(int i=0; i<m; i++){
      var cd = Console.ReadLine().Split();
      c[i] = int.Parse(cd[i]);
      d[i] = int.Parse(cd[i]);
    }
    
    for(int i=0; i<n; i++){
      int min = 100000000;
      for(int j=0; j<m; j++){
        int l = Math.Abs(a[i]-c[j]) + Math.Abs(b[i]-d[j]);
        if(l < min) min = l;
      }
      Console.WriteLine(min);
    }
  }
}
