#include <bits/stdc++.h>
using namespace std;
namespace {
const int MAX = 100000000;
int N;
int M;
int NX[51];
int NY[51];
int MX[51];
int MY[51];
int A[51];
}  // namespace
int main(int argc, char *argv[]) {
  int i;
  int j;
  int iNum;
  int iLen;
  int iChk;
  cin >> N;
  if (N < 1 || N > 50) return 0;
  cin >> M;
  if (M < 1 || M > 50) return 0;
  for (i = 1; i <= N; i++) {
    cin >> NX[i];
    if (NX[i] < -MAX || NX[i] > MAX) return 0;
    cin >> NY[i];
    if (NY[i] < -MAX || NY[i] > MAX) return 0;
  }
  for (j = 1; j <= M; j++) {
    cin >> MX[i];
    if (MX[j] < -MAX || MX[j] > MAX) return 0;
    cin >> MY[i];
    if (MY[j] < -MAX || MY[j] > MAX) return 0;
  }
  for (i = 1; i <= N; i++) {
    iNum = 0;
    iLen = -1;
    for (j = 1; j <= M; j++) {
      iChk = abs(NX[i] - MX[j]) + abs(NY[i] - MY[j]);
      if (iLen < 0 || iLen > iChk) {
        iNum = j;
        iLen = iChk;
      }
    }
    A[i] = iNum;
  }
  for (i = 1; i <= N; i++) cout << A[i];
  return 0;
}
