#include <bits/stdc++.h>
using namespace std;
long long sq(long long x) { return x * x; }
void mul_mod(long long& a, long long b) {
  a *= b;
  a %= (1000000007ll);
}
bool isvowel(char c) {
  int i;
  string v = "aeiou";
  for (i = (v.size() - 1); i >= 0; --i) {
    if (c == v[i]) {
      return true;
    }
  }
  return false;
}
long long manhattan(long long x1, long long y1, long long x2, long long y2) {
  return ((long long)(abs(x1 - x2) + abs(y1 - y2)));
}
int main(void) {
  int n, m, i, j;
  long long a[55], b[55], c[55], d[55], ans[55];
  fill(ans, ans + 55, (1ll << 60));
  cin >> n >> m;
  for (i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  for (j = 0; j < m; ++j) {
    cin >> c[i] >> d[i];
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      ans[i] = min(ans[i], manhattan(a[i], b[i], c[j], d[j]));
    }
    cout << ans[i] << endl;
  }
  return 0;
}
