#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 31;
const long long MOD = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  long long a[50], b[50], c[50], d[50];
  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) {
    long long ans = INF;
    for (int j = 0; j < m; ++j) {
      if (abs(a[i] - c[j]) + abs(b[i] - d[j]) < INF) {
        ans = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      }
    }
    cout << ans << endl;
  }
}
