#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    int cnt = 1e9;
    int ans = 0;
    for (int j = 0; j < M; j++) {
      int c, d;
      cin >> c >> d;
      if (abs(a - c) + abs(b - d) < cnt) {
        ans = j;
      }
    }
    cout << ans << endl;
  }
}
