Problem: Klein is trying to get her dog Jack into the Frisbee Dog Tournament. But she's not sure if Jack will get a good grade. For her, she simulates the tournament to get Jack's grade. I want you to create a program to estimate.

The tournament is held by N dogs on a two-dimensional plane. At the start of the tournament, the i-th dog is in the (Dix, Diy) position. The i-th dog is Vi [m / s] All dogs are small enough to be considered points. At any given time, two or more dogs may be in the same position.

The tournament begins with the launch of the first Frisbee, from which the dogs are allowed to move. Frisbee can also be considered a point, the i Frisbee from the (FPix, FPiy) position ( FVix, FViy) Fired at a velocity vector of [m / s] and continues a constant velocity linear motion. When a dog's position and a Frisbee's position are equal, the dog can get a Frisbee.

The moment the first Frisbee is acquired by one of the dogs, the second Frisbee is fired. The moment the second Frisbee is acquired, the third is fired, and so on. Immediately after, the next Frisbee will be fired. The tournament will end when the Mth Frisbee is acquired.

Needless to say, the dogs' goal is to get more Frisbee. Dogs take the following strategies.

When the Frisbee is fired, the dog moves to get it at the earliest possible time and gets the Frisbee. However, if it cannot get the Frisbee, it waits where it is.

The determination of whether a dog can get a frisbee is made regardless of the behavior of the other dog. That is, one dog moves to get a frisbee, but the other dog gets it first. The moment one of the dogs gets the Frisbee and a new Frisbee is launched, the dogs take the above strategy against the new Frisbee.

The program you create must output the number of Frisbees obtained by each dog.



Input

The input file consists of multiple datasets.

The first row of the dataset gives the number of dogs N (1 ≤ N ≤ 10) and the number of Frisbees M (1 ≤ M ≤ 1000).

The following N lines are given the dog's initial position and velocity Dix, Diy, Vi, separated by a single blank.

The following M lines are given the Frisbee launch position and velocity FPix, FPiy, FVix, FViy, separated by a single space character.

The coordinate values ​​given are real numbers and their absolute values ​​do not exceed 1000. The speeds given are real numbers 1 ≤ DVi ≤ 100, -25 ≤ FVix, FViy ≤ 25. Frisbees that cannot be obtained by any dog You can assume that there is no.

When a dog with any Frisbee was obtained at time t, no dog could get it before time t + 1e-6.

During the simulation, the absolute values ​​of the dog's x and y coordinates do not exceed 1e + 8.

When both N and M are 0, the end of input is indicated.

Output

Output the number of Frisbees obtained by each dog on one line separated by a space character. The order of output must be the same as the order given in the input.

Example

Input

2 1
12 5 3
0 17 3
0 0 2 2
2 3
2 0 2
100 100 2
0 0 -1 0
-2 -5 0 3
100 100 1 1
0 0


Output

1 0
2 1

Solution (in CPP):

Solution:
#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;
}