#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
struct edge {
  int a, b, c, flow = 0, cost;
  edge() { a = 0, b = 0, c = 0, cost = 0; }
  edge(int _a, int _b, int _c, int _cost) {
    a = _a, b = _b, c = _c, cost = _cost;
  }
};
vector<vector<int>> g;
vector<edge> e;
void insert_edge(int a, int b, int c, int cost) {
  g[a].push_back(e.size());
  e.push_back(edge(a, b, c, cost));
  g[b].push_back(e.size());
  e.push_back(edge(b, a, 0, -cost));
}
vector<int> d, p;
bool ford(int s, int t, int b) {
  int n = g.size();
  d = vector<int>(n, inf);
  p = vector<int>(n, -1);
  d[s] = 0;
  for (int i = 0; i < n; ++i) {
    bool ok = false;
    for (int j = 0; j < (int)e.size(); ++j) {
      edge& e1 = e[j];
      if (e1.c - e1.flow <= 0) continue;
      if (d[e1.b] > d[e1.a] + e1.cost) {
        d[e1.b] = d[e1.a] + e1.cost;
        p[e1.b] = j;
        ok = true;
      }
    }
    if (!ok) break;
  }
  if (p[t] == -1) return false;
  return true;
}
vector<int> path, ind;
void block(int t) {
  vector<int> path;
  while (p[t] != -1) {
    path.push_back(p[t]);
    t = e[p[t]].a;
  }
  int minf = inf;
  for (auto elem : path) {
    minf = min(minf, e[elem].c - e[elem].flow);
  }
  for (auto elem : path) {
    e[elem].flow += minf;
    e[elem ^ 1].flow -= minf;
  }
  path.clear();
}
int m;
void getans(int s, int t) {
  while (m-- && ford(s, t, 0)) {
    block(t);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n >> m;
  vector<int> a(n), b(n), c(n);
  vector<int> coord;
  g.resize(2 * n + 2);
  p.resize(n * 2 + 2);
  d.resize(n * 2 + 2);
  ind.resize(n * 2 + 2);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> c[i];
  }
  int S = 2 * n, T = 2 * n + 1;
  for (int i = 0; i < n; ++i) {
    insert_edge(S, i, 1, 0);
    insert_edge(i, n + i, 1, -c[i]);
    insert_edge(i + n, T, 1, 0);
    for (int j = 0; j < n; ++j) {
      if (a[j] >= a[i] + b[i]) {
        insert_edge(n + i, j, 1, 0);
      }
    }
  }
  getans(S, T);
  for (int i = 0; i < n; ++i) {
    int ans = 0;
    for (auto elem : g[i]) {
      edge e1 = e[elem];
      if (e1.flow == 1 && e1.b == n + i) {
        ans = 1;
        break;
      }
    }
    cout << ans << ' ';
  }
}
