#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, inf = 1e9 + 7;
int n, k;
int cnt = 0;
const int MAXN = 2010;
int CINF = 1e9;
int INF = 1e9;
struct graph {
  struct Edge {
    int x, y;
    int cap;
    int cost;
    int id;
  };
  int N, prev[MAXN];
  int dist[MAXN], phi[MAXN];
  vector<Edge> E;
  vector<int> g[MAXN];
  graph(int _N) : N(_N) {}
  void add_edge(int x, int y, int cap, int cost, int opt = -1) {
    Edge e1 = {x, y, cap, cost, opt}, e2 = {y, x, 0, -cost, -1};
    g[x].emplace_back(E.size());
    E.emplace_back(e1);
    g[y].emplace_back(E.size());
    E.emplace_back(e2);
  }
  bool augment(int s, int t) {
    int x, y;
    for (int i = 0; i <= N; i++) prev[i] = -1, dist[i] = INF;
    dist[s] = prev[s] = 0;
    set<pair<int, int> > q;
    q.insert(make_pair(dist[s], s));
    while (!q.empty()) {
      x = q.begin()->second;
      q.erase(q.begin());
      for (auto it : g[x]) {
        Edge &e = E[it];
        if (e.cap <= 0) continue;
        y = e.y;
        int ncost = e.cost + phi[x] - phi[y];
        if (dist[x] + ncost < dist[y]) {
          q.erase(make_pair(dist[y], y));
          dist[y] = dist[x] + ncost;
          prev[y] = it;
          q.insert(make_pair(dist[y], y));
        }
      }
    }
    if (prev[t] == -1)
      return false;
    else
      return true;
  }
  pair<int, int> mcf(int s, int t, int nn = CINF) {
    int flow = 0;
    int cost = 0;
    for (int i = 0; i <= N; i++) phi[i] = 0;
    while (true) {
      if (!augment(s, t) || flow == nn) break;
      int z = nn - flow;
      for (int i = t; i != s; i = E[prev[i]].x) z = min(z, E[prev[i]].cap);
      for (int i = t; i != s; i = E[prev[i]].x)
        E[prev[i]].cap -= z, E[prev[i] ^ 1].cap += z;
      flow += z;
      cost += z * (dist[t] - phi[s] + phi[t]);
      for (int i = 0; i <= N; i++)
        if (prev[i] != -1) phi[i] += dist[i];
    }
    for (int i = 2 * cnt + 2; i < E.size(); i += 2) {
      if (E[i].cap == 0)
        cout << 1 << " ";
      else
        cout << 0 << " ";
    }
    return make_pair(flow, cost);
  }
};
int s[N], t[N], c[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int i, j, a = 0, b = 0;
  cin >> n >> k;
  set<int> st;
  map<int, int> m;
  for (i = 1; i <= n; i++)
    cin >> s[i] >> t[i] >> c[i], t[i] += s[i], st.insert(s[i]), st.insert(t[i]);
  for (auto i : st) m[i] = ++cnt;
  graph g(cnt + 2);
  for (i = 0; i <= cnt; i++) g.add_edge(i, i + 1, k, 0);
  for (i = 1; i <= n; i++) {
    s[i] = m[s[i]], t[i] = m[t[i]];
    g.add_edge(s[i], t[i], 1, -c[i]);
  }
  g.mcf(0, cnt + 1, k);
}
