#include <bits/stdc++.h>
using namespace std;
int n, m, mn = 1e8;
vector<int> a(1000), b(1000), c(1000), d(1000), v1;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  for (int i = 0; i < m; ++i) cin >> c[i] >> d[i];
  for (int i = 0; i < n; ++i) {
    vector<int> v;
    for (int j = 0; j < m; ++i) {
      v.push_back(abs(a[i] - c[j]) + abs(b[i] - d[j]));
    }
    for (int i = 0; i < v.size(); ++i) mn = min(mn, v[i]);
    v1.push_back(mn);
  }
  for (int i = 0; i < v1.size(); ++i) cout << v1[i] << endl;
  return 0;
}
