#include <bits/stdc++.h>
using namespace std;
int size, n, k, S, T, dis[2010000], que[2010000], i, j, g[2010000], p[2010000],
    in[2010000], flow[2010000], num[2010000], tot, ex[2010000], cnt;
struct node {
  int to, next, f, v;
} e[2010000];
void add1(int o, int p, int q, int w) {
  e[++size].to = p, e[size].next = g[o], g[o] = size, e[size].f = q,
  e[size].v = w;
}
void add(int o, int p, int q, int w) { add1(o, p, q, w), add1(p, o, 0, -w); }
struct node1 {
  int s, t, val;
} a[2010000];
bool check(int i, int j) {
  int tmp = a[i].s + a[i].t - 1;
  return tmp < a[j].s;
}
int mcmf() {
  for (int i = S; i <= T; i++) dis[i] = -100000000;
  dis[S] = 0;
  int head = 0, tail = 0;
  que[++tail] = S;
  flow[S] = 100000000;
  in[S] = 1;
  while (head != tail) {
    int x = que[++head];
    in[x] = 0;
    if (head == T + 2) head = 0;
    for (int k = g[x]; k; k = e[k].next) {
      int y = e[k].to;
      if (e[k].f && dis[x] + e[k].v > dis[y]) {
        dis[y] = dis[x] + e[k].v;
        p[y] = k;
        flow[y] = min(flow[x], e[k].f);
        if (in[y] == 0) {
          que[++tail] = y, in[y] = 1;
          if (tail == T + 2) tail = 0;
        }
      }
    }
  }
  if (dis[T] == -100000000) return 0;
  int now = p[T];
  while (now)
    e[now].f -= flow[T], e[now ^ 1].f += flow[T], now = p[e[now ^ 1].to];
  return 1;
}
void init() {
  sort(ex + 1, ex + 1 + cnt);
  tot = unique(ex + 1, ex + 1 + cnt) - ex - 1;
  for (i = 1; i <= n; i++) {
    a[i].s = lower_bound(ex + 1, ex + 1 + tot, a[i].s) - ex;
    a[i].t = lower_bound(ex + 1, ex + 1 + tot, a[i].t) - ex;
  }
}
int main() {
  scanf("%d %d", &n, &k);
  size = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d", &a[i].s, &a[i].t, &a[i].val);
    a[i].t += a[i].s;
    ex[++cnt] = a[i].s, ex[++cnt] = a[i].t;
  }
  init();
  S = 0, T = tot + 1;
  for (i = 0; i <= tot; i++) add(i, i + 1, k, 0);
  for (i = 1; i <= n; i++) add(a[i].s, a[i].t, 1, a[i].val), num[i] = size - 1;
  while (mcmf())
    ;
  for (i = 1; i <= n; i++) printf("%d ", 1 - e[num[i]].f);
}
