#include <bits/stdc++.h>
using namespace std;
struct T {
  int i, v;
  T(int i = 0, int v = 0) : i(i), v(v) {}
};
bool operator<(T a, T b) { return a.v > b.v; }
int l, n, u[10010], w[10010], p[10010], a[2 * 100010], c[2 * 100010],
    e[2 * 100010];
vector<int> m[10010];
priority_queue<T> q;
void push(int i, int v, int j) {
  if (v < u[i]) {
    u[i] = v;
    p[i] = j;
    q.push(T(i, v));
  }
}
bool bfs(int b, int s) {
  int i, v, j, k;
  for (fill(u, u + n, 1000000000), push(b, 0, -1); !q.empty();) {
    i = q.top().i;
    v = q.top().v;
    q.pop();
    if (v == u[i])
      for (j = 0; j < m[i].size(); j++)
        if (a[k = m[i][j]]) push(e[k], v + c[k] + w[i] - w[e[k]], k);
  }
  return u[s] < 1000000000;
}
int mcmf(int b, int s) {
  int i, j, f;
  for (i = 0; i < n; w[i] = 1000000000, i++)
    ;
  for (w[0] = 0, i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      for (f = 0; f < m[j].size(); f++)
        if (a[m[j][f]] > 0)
          if (w[j] + c[m[j][f]] < w[e[m[j][f]]])
            w[e[m[j][f]]] = w[j] + c[m[j][f]];
  for (; bfs(b, s);) {
    for (j = 1000000000, i = s; i != b; j = min(j, a[p[i]]), i = e[p[i] ^ 1])
      ;
    for (i = s; i != b;
         a[p[i]] -= j, a[p[i] ^ 1] += j, f += c[p[i]] * j, i = e[p[i] ^ 1])
      ;
    for (i = 0; i < n; w[i] += (u[i] - 1000000000) & u[i], i++)
      ;
  }
  return f;
}
void add(int i, int j, int v, int p) {
  e[l] = j;
  a[l] = v;
  c[l] = p;
  m[i].push_back(l++);
  e[l] = i;
  a[l] = 0;
  c[l] = -p;
  m[j].push_back(l++);
}
map<int, int> y;
map<int, int>::iterator it;
int s[10010], f[10010], z[10010];
int main() {
  int i, k, d, v;
  for (scanf("%d%d", &n, &k), v = n, i = 0; i < n;
       scanf("%d%d%d", &s[i], &f[i], &z[i]), f[i] += s[i], y[s[i]] = 1,
                              y[f[i]] = 1, i++)
    ;
  y[-1] = 1;
  y[1000000000] = 1;
  for (i = 0, it = y.begin(); it != y.end(); it->second = i, i++, it++)
    ;
  d = y.size();
  for (i = 0; i < d - 1; add(i, i + 1, k, 0), i++)
    ;
  for (i = 0; i < n;
       add(y[s[i]], d + i, 1, 0), add(d + i, y[f[i]], 1, -z[i]), i++)
    ;
  n = d + v;
  mcmf(0, d - 1);
  n = v;
  for (i = 0; i < n;
       k = a[m[d + i][1]] == 0, printf("%d%c", k, i < n - 1 ? ' ' : '\n'), i++)
    ;
  return 0;
}
