#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  long long P[60][60] = {};
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    P[i][i] = a;
    P[i][i + 1] = b;
  }
  long long Q[60][60] = {};
  for (int i = 0; i < M; i++) {
    long long c, d;
    cin >> c >> d;
    Q[i][i] = c;
    Q[i][i + 1] = d;
  }
  for (int i = 0; i < N; i++) {
    long long distance = 100000000;
    int point;
    for (int j = M - 1; j >= 0; j--) {
      if (distance >= abs(P[i][i] - Q[j][j]) + abs(P[i][i + 1] - Q[j][j + 1])) {
        distance = abs(P[i][i] - Q[j][j]) + abs(P[i][i + 1] - Q[j][j + 1]);
        point = j + 1;
      }
    }
    cout << point << endl;
  }
}
