#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 233;
struct Edge {
  int from, to, cap, flow, cost;
};
vector<Edge> edges;
vector<int> g[maxn];
queue<int> q;
int d[maxn], p[maxn];
bool inq[maxn];
void add_edge(int from, int to, int cap, int cost) {
  edges.push_back((Edge){from, to, cap, 0, cost});
  edges.push_back((Edge){to, from, 0, 0, -cost});
  int m = edges.size();
  g[from].push_back(m - 2);
  g[to].push_back(m - 1);
  return;
}
struct MCMF {
  int s, t;
  bool spfa() {
    for (int i = 0; i < maxn; i++) d[i] = 1 << 30;
    d[s] = 0;
    q.push(s);
    p[s] = -1;
    inq[s] = 1;
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      inq[x] = 0;
      for (int i = 0; i < g[x].size(); i++) {
        Edge e = edges[g[x][i]];
        if (e.flow == e.cap) continue;
        int y = e.to;
        if (d[y] > d[x] + e.cost) {
          d[y] = d[x] + e.cost;
          p[y] = g[x][i];
          if (!inq[y]) q.push(y);
          inq[y] = 1;
        }
      }
    }
    if (d[t] == (1 << 30)) return 0;
    return 1;
  }
  int mincost(int s, int t) {
    this->s = s;
    this->t = t;
    int cost = 0, flow = 0;
    while (spfa()) {
      int f = 1 << 30;
      for (int i = p[t]; i != -1; i = p[edges[i].from]) {
        Edge e = edges[i];
        f = min(f, e.cap - e.flow);
      }
      flow += f;
      for (int i = p[t]; i != -1; i = p[edges[i].from]) {
        Edge& e = edges[i];
        e.flow += f;
        edges[i ^ 1].flow -= f;
        cost += f * e.cost;
      }
    }
    return cost;
  }
} F;
int s[maxn], t[maxn], v[maxn], pos[maxn];
int main() {
  int n, k;
  cin >> n >> k;
  int cur = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &s[i], &t[i], &v[i]);
    t[i] += s[i];
    pos[++cur] = s[i];
    pos[++cur] = t[i];
  }
  sort(pos + 1, pos + 1 + 2 * n);
  for (int i = 1; i <= n; i++) {
    int l = lower_bound(pos + 1, pos + 1 + 2 * n, s[i]) - pos;
    int r = lower_bound(pos + 1, pos + 1 + 2 * n, t[i]) - pos;
    add_edge(l, r, 1, -v[i]);
  }
  add_edge(0, 1, k, 0);
  for (int i = 1; i < 2 * n; i++) add_edge(i, i + 1, (1 << 30), 0);
  F.mincost(0, 2 * n);
  for (int i = 1; i <= n; i++)
    if (edges[(i - 1) << 1].flow)
      printf("1 ");
    else
      printf("0 ");
  return 0;
}
