#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> p(n);
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  vector<pair<int, int>> c(m);
  for (int i = 0; i < m; i++) cin >> c[i].first >> c[i].second;
  for (int i = 0; i < n; i++) {
    int x = 1000000000;
    int ans;
    for (int j = 0; j < m; j++) {
      if (x > abs(p[i].first - c[j].second) + abs(p[i].first - c[j].second)) {
        x = abs(p[i].first - c[j].second) + abs(p[i].first - c[j].second);
        ans = j + 1;
      }
    }
    cout << ans << endl;
  }
}
