#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  long long a[50], b[50], c[50], d[50], m;
  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++) {
    m = 100000000000000;
    for (int j = 0; j < M; j++) {
      m = min(m, abs(a[i] - c[j]) + abs(b[i] - d[j]));
    }
    cout << m << endl;
  }
  return 0;
}
