#include <bits/stdc++.h>
using namespace std;
const int maxn = 10001;
int st, en;
const int limit = -5000000;
const int maxlongint = 1 << 20;
struct edges {
  int v, flow, rev;
  int cost;
} make;
vector<edges> g[maxn];
int dist[maxn];
bool vis[maxn];
int tot;
bool ans[maxn];
int i, j, m, n, l, o, p, x, y, z;
int k;
struct pairs {
  int x, y;
} pre[maxn];
struct tris {
  int s, t, fee;
} sp[maxn];
inline bool spfa() {
  for (int i = 0; i <= st; i++) dist[i] = maxlongint;
  dist[st] = 0;
  queue<int> q;
  q.push(st);
  while (!q.empty()) {
    int x = q.front();
    vis[x] = false;
    q.pop();
    for (int i = 0; i < g[x].size(); i++)
      if (g[x][i].flow && dist[g[x][i].v] > dist[x] + g[x][i].cost) {
        dist[g[x][i].v] = dist[x] + g[x][i].cost;
        pre[g[x][i].v].x = x;
        pre[g[x][i].v].y = i;
        if (!vis[g[x][i].v]) {
          q.push(g[x][i].v);
          vis[g[x][i].v] = true;
        }
      }
  }
  return dist[en] < maxlongint;
}
inline void addedge(int x, int y, int flow, int cost) {
  int v1 = g[x].size();
  int v2 = g[y].size();
  make.v = y;
  make.flow = flow;
  make.cost = cost;
  make.rev = v2;
  g[x].push_back(make);
  make.v = x;
  make.flow = 0;
  make.rev = v1;
  make.cost = -cost;
  g[y].push_back(make);
}
int mincut(int x, int fw) {
  int t = x, f;
  while (t != st) {
    f = min(fw, g[pre[x].x][pre[x].y].flow);
    t = pre[t].x;
  }
  t = x;
  while (t != st) {
    g[pre[t].x][pre[t].y].flow -= f;
    g[t][g[pre[t].x][pre[t].y].rev].flow += f;
    t = pre[t].x;
  }
  return f;
}
int main() {
  scanf("%d%d", &n, &k);
  en = 2 * n + 1;
  st = en + 1;
  addedge(st, 0, k, 0);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &sp[i].s, &sp[i].t, &sp[i].fee);
    addedge(0, i * 2 - 1, 1, 0);
    addedge(i * 2 - 1, i * 2, 1, -sp[i].fee);
    addedge(i * 2, en, 1, 0);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (sp[i].s + sp[i].t <= sp[j].s) addedge(i * 2, j * 2 - 1, 1, 0);
  while (spfa()) mincut(en, maxlongint);
  for (int i = 1; i <= n; i++)
    for (j = 0; j < g[i * 2 - 1].size(); j++)
      if (g[i * 2 - 1][j].v == i * 2 && g[i * 2 - 1][j].flow == 0)
        ans[i] = true;
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  cout << endl;
  fclose(stdin);
  return 0;
}
