#include <bits/stdc++.h>
using namespace std;
int f(int a, int b, int c, int d) {
  return max(a, b) + max(c, d) - min(a, b) - min(c, d);
}
int main() {
  int N, M, l, x, y;
  cin >> N >> M;
  vector<int> a(N), b(N), c(M), d(M);
  for (int i = 0; i < N; i++) cin >> a.at(i) >> b.at(i);
  for (int i = 0; i < M; i++) cin >> c.at(i) >> d.at(i);
  for (int i = 0; i < N; i++) {
    x = 0;
    for (int j = 1; j < M; j++) {
      if (f(a.at(i), b.at(i), c.at(x), d.at(x)) >
          f(a.at(i), b.at(i), c.at(j), d.at(j)))
        x = i;
    }
    cout << x << endl;
  }
}
