#include <bits/stdc++.h>
using namespace std;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> >
    IntReversePrioQueue;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 1, -1, 1, 0, -1};
int dy8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
void solve(void) {
  int n, m;
  cin >> n >> m;
  pair<long long, long long> students[50];
  pair<long long, long long> checkpoints[50];
  for (int i = 0; i <= n - 1; i++)
    scanf("%lld%lld\n", &students[i].first, &students[i].second);
  for (int i = 0; i <= m - 1; i++)
    scanf("%lld%lld\n", &checkpoints[i].first, &checkpoints[i].second);
  for (int i = 0; i <= n - 1; i++) {
    long long man_len = 1000000000;
    int index = 0;
    for (int j = 0; j <= m - 1; j++) {
      if (man_len > abs(checkpoints[j].first - students[i].first) +
                        abs(checkpoints[j].second - students[i].second)) {
        man_len = abs(checkpoints[j].first - students[i].first) +
                  abs(checkpoints[j].second - students[i].second);
        index = j;
      }
    }
    cout << index + 1;
  }
  cout << '\n';
}
int main(void) {
  solve();
  return 0;
}
