#include <bits/stdc++.h>
using namespace std;
inline int ceiling(int n, int d) { return n % d == 0 ? n / d : n / d + 1; }
inline int dis(pair<int, int> a, pair<int, int> b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}
int main() {
  int N, M;
  cin >> N >> M;
  using pos = pair<int, int>;
  auto people = vector<pos>(N);
  auto points = vector<pos>(N);
  for (size_t i = 0; i < N; i++) cin >> people[i].first >> people[i].second;
  for (size_t i = 0; i < M; i++) cin >> points[i].first >> points[i].second;
  for (size_t i = 0; i < N; i++) {
    int min_dis = 1000000000;
    for (size_t j = 0; j < M; j++) {
      min_dis = min(min_dis, dis(people[i], points[j]));
    }
    cout << min_dis << endl;
  }
}
