#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int N,M;
  ll ans=0;
  ll dis=1000000000;
  cin >> N >>M;
  ll a[50], b[50],c[50] d[50];
  
  for (ll i=0; i<N; i++) {
    cin >> a[i] >> b[i];
  }
  for (ll i=0; i<M; i++) {
    cin >> c[i] >> d[i];
  }
  for (ll i=0; i<N; i++) {
    dis=1000000000
      for (ll j=0; j<M; j++) {
        if (abs(a[i]-c[j])+abs(b[i]-d[j]))<dis){
          ans=j;
          dis=abs(a[i]-c[j])+abs(b[i]-d[j]));
        }
      cout << ans;
  }
}