#include <bits/stdc++.h>
using namespace std;
inline void Fail() {
  printf("0");
  exit(0);
}
inline void debug(int x) { cerr << "debug: " << x << "\n"; }
inline void debug(int n, int x[]) {
  cerr << "debug "
       << "\n";
  for (int(i) = 0; (i) < n; i++) cerr << x[i] << " ";
  cerr << "\n";
}
inline void debug(string x) { cerr << "debug: " << x << "\n"; }
const int maxn = 1005;
int n, k, cnt;
class EDGE {
 public:
  int to, cap, cost, rev;
};
vector<EDGE> edge[maxn * 2];
int prevv[maxn * 2], preve[maxn * 2], id[maxn * 2];
long long dist[maxn * 2], h[maxn * 2];
int s[maxn], t[maxn], pro[maxn];
vector<int> all;
void add_edge(int from, int to, int cap, int cost) {
  cost = -cost;
  edge[from].push_back((EDGE){to, cap, cost, (int)edge[to].size()});
  edge[to].push_back((EDGE){from, 0, -cost, (int)edge[from].size() - 1});
}
void min_cost_flow(int s, int t, int f) {
  while (f > 0) {
    priority_queue<pair<int, int> > q;
    for (int(i) = 0; (i) < t + 1; i++) dist[i] = 10LL * 1e9;
    dist[s] = 0;
    q.push(make_pair(0, s));
    while (!q.empty()) {
      pair<int, int> x = q.top();
      q.pop();
      x.first = -x.first;
      int v = x.second;
      if (dist[v] < x.first) continue;
      for (int(i) = 0; (i) < edge[v].size(); i++) {
        EDGE &y = edge[v][i];
        if (y.cap > 0 && dist[y.to] > dist[v] + y.cost + h[v] - h[y.to]) {
          dist[y.to] = dist[v] + y.cost + h[v] - h[y.to];
          prevv[y.to] = v;
          preve[y.to] = i;
          q.push(make_pair(-dist[y.to], y.to));
        }
      }
    }
    for (int(i) = 0; (i) < t + 1; i++) h[i] += dist[i];
    int d = f;
    for (int v = t; v != s; v = prevv[v])
      d = min(d, edge[prevv[v]][preve[v]].cap);
    f -= d;
    for (int v = t; v != s; v = prevv[v]) {
      EDGE &x = edge[prevv[v]][preve[v]];
      x.cap -= d;
      edge[v][x.rev].cap += d;
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int(i) = 1; (i) <= n; i++) {
    scanf("%d%d%d", &s[i], &t[i], &pro[i]);
    t[i] = s[i] + t[i];
    all.push_back(s[i]);
    all.push_back(t[i]);
  }
  sort(all.begin(), all.end());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  for (int(i) = 1; (i) <= n; i++) {
    s[i] = lower_bound(all.begin(), all.end(), s[i]) - all.begin() + 1;
    t[i] = lower_bound(all.begin(), all.end(), t[i]) - all.begin() + 1;
    id[i] = edge[s[i]].size();
    add_edge(s[i], t[i], 1, pro[i]);
  }
  for (int(i) = 1; (i) <= all.size(); i++) add_edge(i, i + 1, k, 0);
  add_edge(0, 1, k, 0);
  if (k > n) {
    for (int(i) = 0; (i) < n; i++) printf("%d ", 1);
    return 0;
  }
  min_cost_flow(0, all.size() + 1, k);
  for (int(i) = 1; (i) <= n; i++) printf("%d ", !edge[s[i]][id[i]].cap);
  return 0;
}
