#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define INF 1000000000

typedef long long ll;
typedef pair<ll, ll> P;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z


int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
    int n, m;
    cin >> n >> m;
    P students[n];
    P checkpoints[m];
    rep(n, i) scanf("%lld%lld\n", &students[i].first, &students[i].second);
    rep(m, i) scanf("%lld%lld\n", &checkpoints[i].first, &checkpoints[i].second);
    rep(n, i){
        ll man_len = INF;
        int index = 0;
        rep(m, j) {
            if (man_len > abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second)) {
                man_len = abs(checkpoints[j].first - students.first) + abs(checkpoints[j].second - students.second);
                index = j;
            }
        }
        cout << index+1;
    }
    cout << '\n';
}

int main(void){
  solve();
  return 0;
}
