#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[n], c[m], d[m];
  int i;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (i = 0; i < m; i++) {
    cin >> c[i] >> d[i];
  }
  int min = 2e9;
  for (i = 0; i < n; i++) {
    for (int j = m - 1; j >= 0; j--) {
      if (min > abs(a[i] - c[j]) + abs(b[i] - d[j])) {
        min = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      }
    }
    cout << min << endl;
  }
  return 0;
}
