#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

class Vec;
Vec operator/(const Vec& v, const double& divisor);
Vec operator*(const double& scale, const Vec& v);

class Vec {
  using F = double;
  vector<F> container;

 public:
  explicit Vec(size_t size) : container(size) {}
  explicit Vec(initializer_list<F> elements)
      : container(elements.begin(), elements.end()) {}
  size_t dim() const { return container.size(); }
  F& operator[](const size_t size) { return container.at(size); }
  const F& operator[](const size_t size) const { return container.at(size); }
  Vec operator+(const Vec& other) const {
    Vec ret(*this);
    for (size_t i = 0; i < dim(); i++) ret[i] += other[i];
    return ret;
  }
  Vec operator-(const Vec& other) const { return (*this) + (-other); }
  Vec operator-() const { return -1.0 * (*this); }
  F inner(const Vec& other) const {
    F acc = 0;
    for (size_t i = 0; i < dim(); i++) {
      acc += (*this)[i] * other[i];
    }
    return acc;
  }
  Vec& operator+=(const Vec& other) {
    for (size_t i = 0; i < dim(); i++) {
      (*this)[i] += other[i];
    }
    return *this;
  }
  F norm() const { return sqrt(inner(*this)); }
  Vec unit() const { return (*this) / this->norm(); }
  F ccw(const Vec& other) const {
    return (*this)[0] * other[1] - other[0] * (*this)[1];
  }
  Vec normal() const { return Vec({-(*this)[1], (*this)[0]}); }
};
Vec operator/(const Vec& v, const double& divisor) { return 1.0 / divisor * v; }
Vec operator*(const double& scale, const Vec& v) {
  Vec ret(v);
  for (size_t i = 0; i < ret.dim(); i++) ret[i] *= scale;
  return ret;
}

pair<vector<double>, bool> solve_linear(double a, double b, double eps);
pair<vector<double>, bool> solve_quad(double a, double b, double c, double eps);
vector<double> solve_quad(double a, double b, double eps);

/// solve ax+b=0
pair<vector<double>, bool> solve_linear(double a, double b, double eps) {
  vector<double> sol;
  if (abs(a) > eps) {
    sol.push_back(-b / a);
    return make_pair(sol, false);
  } else if (abs(b) > eps) {
    return make_pair(sol, false);
  } else {
    return make_pair(sol, true);
  }
}

/// solve ax^2+bx+c=0
pair<vector<double>, bool> solve_quad(double a, double b, double c,
                                      double eps) {
  if (abs(a) > eps) {
    return make_pair(solve_quad(b / a, c / a, eps), false);
  } else {
    return solve_linear(b, c, eps);
  }
}

/// solve x^2+ax+b=0
vector<double> solve_quad(double a, double b, double eps) {
  double det = a * a - 4 * b;
  vector<double> result;
  if (!(det < 0)) {
    if (det < eps) {
      result.push_back(-a / 2);
    } else {
      const double r = sqrt(det) / 2;
      result.push_back(-a / 2 - r);
      result.push_back(-a / 2 + r);
    }
  }

  return result;
}

void solve(int N, int M) {
  vector<Vec> dog;
  vector<double> dogv;
  rep(i, N) {
    double x, y, v;
    cin >> x >> y >> v;
    dog.push_back(Vec({x, y}));
    dogv.push_back(v);
  }

  vector<int> cnt(N, 0);
  rep(i, M) {
    double x, y, ux, uy;
    cin >> x >> y >> ux >> uy;
    Vec p({x, y}), u({ux, uy});

    int j;
    double t = numeric_limits<double>::max();

    vector<Vec> v;
    rep(i, N) {
      const Vec d = p - dog[i];
      const double EPS = 1e-9;
      vector<double> sol;
      bool eq;
      tie(sol, eq) = solve_quad(u.norm() * u.norm() - dogv[i] * dogv[i],
                                2 * d.inner(u), d.norm() * d.norm(), EPS);
      if (eq) {
        t = 0;
        j = i;
        v.push_back(Vec({0, 0}));
      } else {
        sol.push_back(numeric_limits<double>::max());
        sort(sol.begin(), sol.end());
        double s =
            *min_element(lower_bound(sol.begin(), sol.end(), 0), sol.end());

        const double INF = 1e9;
        if (s < EPS) {
          v.push_back(Vec({0, 0}));
        } else if (s > INF) {
          v.push_back(Vec({0, 0}));
        } else {
          v.push_back(u + d / s);
        }
        if (t > s) {
          t = s;
          j = i;
        }
      }
    }
    cnt[j]++;
    rep(i, N) { dog[i] += t * v[i]; }
  }

  rep(i, N) {
    cout << cnt[i];
    if (i < N - 1) cout << " ";
  }
  cout << "\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  while (N != 0 || M != 0) {
    solve(N, M);
    cin >> N >> M;
  }
  return 0;
}


Measured memory_bytes: 3324