#include <bits/stdc++.h>
using namespace std;
int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  T g = gcd(a, b);
  return a / g * b;
}
bool check(vector<int> a, int index, int key) {
  if (a[index] >= key)
    return true;
  else
    return false;
}
int lower_bound(vector<int> a, int key) {
  int left = -1, right = a.size();
  while (right - left > 1) {
    int mid = left + (left + right) / 2;
    if (check(a, mid, key))
      right = mid;
    else
      left = mid;
  }
  return right;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(N), b(N), c(M), d(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++) {
    int ans = inf;
    for (int j = 0; j < M; j++) {
      ans = min(ans, abs(a[i] - c[i]) + abs(b[i] - d[i]));
    }
    cout << ans << endl;
  }
  return 0;
}
