#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5, INF = 1e18;
struct edge {
  long long u, v, cap, flow, cost;
};
long long n, k, st, en;
long long l[N], r[N], c[N], d[N], pa[N], ind[N];
bool inqueue[N];
vector<edge> e;
vector<long long> adj[N], inp;
void addEdge(long long u, long long v, long long cap, long long cost,
             long long id) {
  adj[u].push_back(e.size());
  ind[id] = e.size();
  e.push_back(edge{u, v, cap, 0, cost});
  adj[v].push_back(e.size());
  e.push_back(edge{v, u, 0, 0, -cost});
}
bool bfs() {
  for (long long i = st; i <= en; ++i)
    d[i] = INF, pa[i] = -1, inqueue[i] = false;
  d[st] = 0;
  pa[st] = INF;
  inqueue[st] = true;
  queue<long long> q;
  q.push(st);
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    inqueue[u] = false;
    for (long long id : adj[u]) {
      edge ed = e[id];
      long long v = ed.v;
      if (d[v] > d[u] + ed.cost && ed.flow < ed.cap) {
        d[v] = d[u] + ed.cost;
        pa[v] = id;
        if (!inqueue[v]) {
          inqueue[v] = true;
          q.push(v);
        }
      }
    }
  }
  return pa[en] != -1;
}
void update() {
  long long res = INF, u = en;
  while (u != st) {
    long long id = pa[u];
    res = min(res, e[id].cap - e[id].flow);
    u = (e[id].u == u ? e[id].v : e[id].u);
  }
  u = en;
  while (u != st) {
    long long id = pa[u];
    e[id].flow += res;
    e[id ^ 1].flow -= res;
    u = (e[id].u == u ? e[id].v : e[id].u);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= n; ++i) {
    cin >> l[i] >> r[i] >> c[i];
    r[i] += l[i];
    inp.push_back(l[i]);
    inp.push_back(r[i]);
  }
  sort(inp.begin(), inp.end());
  inp.resize(distance(inp.begin(), unique(inp.begin(), inp.end())));
  long long len = inp.size();
  en = len + 1;
  for (long long i = 0; i <= len; ++i) addEdge(i, i + 1, k, 0, 0);
  for (long long i = 1; i <= n; ++i) {
    l[i] = lower_bound(inp.begin(), inp.end(), l[i]) - inp.begin() + 1;
    r[i] = lower_bound(inp.begin(), inp.end(), r[i]) - inp.begin() + 1;
    addEdge(l[i], r[i], 1, -c[i], i);
  }
  while (bfs()) update();
  for (long long i = 1; i <= n; ++i) cout << e[ind[i]].flow << ' ';
}
