#include <bits/stdc++.h>
using namespace std;
const int MX = 1e4 + 233;
const int INF = 1 << 29;
int read() {
  char k = getchar();
  int x = 0;
  while (k < '0' || k > '9') k = getchar();
  while (k >= '0' && k <= '9') x = x * 10 + k - '0', k = getchar();
  return x;
}
int head[MX], tot = 1;
struct edge {
  int node, next, w, c;
} h[MX * (2 + 1) * 2];
void addedge(int u, int v, int w, int c, int flg = 1) {
  h[++tot] = (edge){v, head[u], w, c}, head[u] = tot;
  if (flg) addedge(v, u, 0, -c, false);
}
struct TASK {
  int l, r, c;
} A[MX];
int B[MX], lshcnt;
int pre[MX], dis[MX], inq[MX], flow[MX];
bool spfa() {
  for (int i = 1; i <= ((lshcnt + 1) + 1); ++i) dis[i] = -INF, pre[i] = 0;
  std::queue<int> q;
  q.push((lshcnt + 1)), dis[(lshcnt + 1)] = 0, flow[(lshcnt + 1)] = INF;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    inq[x] = 0;
    for (int i = head[x], d; i; i = h[i].next) {
      if (dis[d = h[i].node] < dis[x] + h[i].c && h[i].w) {
        dis[d] = dis[x] + h[i].c, pre[d] = i;
        flow[d] = std::min(flow[x], h[i].w);
        if (!inq[d]) inq[d] = 1, q.push(d);
      }
    }
  }
  return pre[((lshcnt + 1) + 1)];
}
int mcmf() {
  int cost = 0;
  while (spfa()) {
    cost += flow[((lshcnt + 1) + 1)] * dis[((lshcnt + 1) + 1)];
    int x = ((lshcnt + 1) + 1);
    while (x != (lshcnt + 1)) {
      h[pre[x]].w -= flow[((lshcnt + 1) + 1)];
      h[pre[x] ^ 1].w += flow[((lshcnt + 1) + 1)];
      x = h[pre[x] ^ 1].node;
    }
  }
  return cost;
}
void solve() {
  int n = read(), k = read();
  for (int i = 1, s, t, c; i <= n; ++i) {
    s = read(), t = read(), c = read();
    int l = s, r = s + t;
    A[i] = (TASK){l, r, c};
    B[i] = l;
    B[i + n] = r;
  }
  std::sort(B + 1, B + 1 + n + n);
  lshcnt = std::unique(B + 1, B + 1 + n + n) - B;
  for (int i = 1; i <= n; ++i) {
    A[i].l = std::lower_bound(B + 1, B + lshcnt, A[i].l) - B;
    A[i].r = std::lower_bound(B + 1, B + lshcnt, A[i].r) - B;
    addedge(A[i].l, A[i].r, 1, A[i].c);
  }
  addedge((lshcnt + 1), 1, k, 0);
  for (int i = 1; i < lshcnt; ++i) {
    addedge(i, i + 1, k, 0);
  }
  addedge(lshcnt, ((lshcnt + 1) + 1), k, 0);
  mcmf();
  for (int i = 1; i <= n; ++i) {
    printf("%d%c", h[i << 1].w == 0, " \n"[i == n]);
  }
}
int main() {
  int QWQ = 1;
  while (QWQ--) solve();
  return 0;
}
