#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n,m;
  cin >>n>>m;
  vector<pair<ll,ll>> a(n);
  vector<pair<ll,ll>> c(m);
  vector<ll> ans(n);
  rep(i,n) cin >>a[i].first>>a[i].second;
  rep(i,m) cin >>b[i].first>>b[i].second;
  rep(i,n) ans[i]=abs(a[i].first-b[0].first)+abs(a[i].second-b[0].second);
  rep(i,n){
    rep(j,m-1){
      if(abs(a[i].first-b[i].first)+abs(a[i].second-b[i].second)<(abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second)){
        ans[i]=abs(a[i].first-b[i+1].first)+abs(a[i].second-b[i+1].second);
      }
         }
         }
         rep(i,n) cout <<amns[i]<<endl;
         
        