#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, M, a, b, c, d, min = 200000001;
  cin >> N >> M;
  for (int i = 1; i <= N; i++) {
    cin >> a >> b;
  }
  for (int j = 1; j <= M; j++) {
    cin >> c >> d;
  }
  for (int k = 1; k <= N; k++) {
    if (min > abs(a - b) + abs(c - d)) {
      for (int l = 1; l <= M; l++) {
        min = abs(a - b) + abs(c - d);
      }
    }
    cout << min << endl;
  }
  return 0;
}
