#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  vector<pair<long long, long long>> stu(N);
  vector<pair<long long, long long>> CP(M);
  vector<long long> Point(N);
  for (int i = 0; i < (int)(N); i++) cin >> stu[i].first >> stu[i].second;
  for (int i = 0; i < (int)(M); i++) cin >> CP[i].first >> CP[i].second;
  for (int i = 0; i < (int)(N); i++) {
    long long dis = 1e18;
    for (int j = 0; j < (int)(M); j++) {
      if (dis >
          abs(stu[i].first - CP[j].first) + abs(stu[i].first - CP[i].second)) {
        dis =
            abs(stu[i].first - CP[j].first) + abs(stu[i].first - CP[i].second);
        Point[i] = j + 1;
      }
    }
  }
  for (int i = 0; i < (int)(N); i++) cout << Point[i] << endl;
}
