#include<bits/stdc++.h>

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;
template<class T>
using P = pair<int,int>

int main(){
    int N,M;
    cin >> N >> M;
    vector<P> student(N);
    vector<P> check(M);
    rep(i,N) cin >> student[i].first >> student[i].second;
    rep(i,M) cin >> check[i].first >> check[i].second;
    rep(i,N){
        int min = abs(student[0].first-check[0].first)+abs(student[0].second-check[0].first);
        rep(i,M){
            if(min > abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first)){
                min = abs(student[i].first-check[i].first)+abs(student[i].second-check[i].first);
            }
        }
        cout << min << endl;
    }
    return 0;
}
