#include <bits/stdc++.h>
using namespace std;
int tasks[2010], taskd[2010], taskc[2010], n, k;
inline void scanint(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
struct data {
  int to, cap, cost, flow, rev;
};
vector<data> edge[2010];
data pack(int a, int b, int c, int d, int e) {
  data tmp;
  tmp.to = a, tmp.cap = b, tmp.cost = c, tmp.flow = d, tmp.rev = e;
  return tmp;
}
void addedge(int frm, int to, int cap, int cost) {
  edge[frm].push_back(pack(to, cap, cost, 0, edge[to].size()));
  edge[to].push_back(pack(frm, 0, -cost, 0, edge[frm].size() - 1));
}
void buildmap() {
  for (int i = 1; i <= n; i++) addedge(i, n + i, 1, -taskc[i]);
  for (int i = 1; i <= n; i++) {
    addedge(0, i, 1, 0);
    addedge(n + i, n + n + 1, 1, 0);
    for (int j = 1; j <= n; j++)
      if (tasks[j] > tasks[i] + taskd[i] - 1) addedge(n + i, j, 1, 0);
  }
}
int dist[2010], par[2010], pare[2010], Q[2000000];
bool in[2010];
bool spfa() {
  memset(dist, 0x3f, sizeof dist);
  memset(in, 0, sizeof in);
  dist[0] = 0;
  int tail = 0, head = 0;
  Q[tail++] = 0;
  in[0] = 1;
  while (head != tail) {
    int cur = Q[head++];
    in[cur] = 0;
    for (int i = 0; i < edge[cur].size(); i++) {
      data tmp = edge[cur][i];
      if (tmp.cap > tmp.flow && dist[tmp.to] > dist[cur] + tmp.cost) {
        par[tmp.to] = cur;
        pare[tmp.to] = i;
        dist[tmp.to] = dist[cur] + tmp.cost;
        if (!in[tmp.to]) Q[tail++] = (tmp.to), in[tmp.to] = 1;
      }
    }
  }
  return (dist[n + n + 1] != dist[2007]);
}
int mcmf() {
  int Mcost = 0;
  for (int i = 1; i <= k; i++) {
    if (!spfa()) break;
    for (int cur = n + n + 1; cur != 0; cur = par[cur]) {
      edge[par[cur]][pare[cur]].flow++;
      edge[cur][edge[par[cur]][pare[cur]].rev].flow--;
      Mcost += edge[par[cur]][pare[cur]].cost;
    }
  }
  return -Mcost;
}
int main() {
  scanint(n);
  scanint(k);
  for (int i = 1; i <= n; i++) {
    scanint(tasks[i]);
    scanint(taskd[i]);
    scanint(taskc[i]);
  }
  buildmap();
  mcmf();
  for (int i = 1; i <= n; i++)
    if (edge[i][0].flow == 1)
      putchar('1'), putchar(' ');
    else
      putchar('0'), putchar(' ');
}
