#include <bits/stdc++.h>
using namespace std;
template <int MAXN, typename T = int, typename S = T>
struct MinCostMaxFlow {
  struct NegativeCostCircuitExistsException {};
  struct Edge {
    int v;
    T c;
    S w;
    int b;
    Edge(int v, T c, S w, int b) : v(v), c(c), w(w), b(b) {}
  };
  int n, source, sink;
  vector<Edge> e[MAXN];
  void init(int n, int source, int sink) {
    this->n = n;
    this->source = source;
    this->sink = sink;
    for (int i = 0; i < n; ++i) {
      e[i].clear();
    }
  }
  void addEdge(int a, int b, T c, S w) {
    e[a].push_back(Edge(b, c, w, e[b].size()));
    e[b].push_back(Edge(a, 0, -w, e[a].size() - 1));
  }
  bool mark[MAXN];
  T maxc[MAXN];
  S minw[MAXN];
  int dist[MAXN];
  Edge* prev[MAXN];
  bool _spfa() {
    queue<int> q;
    fill(mark, mark + n, false);
    fill(maxc, maxc + n, 0);
    fill(minw, minw + n, numeric_limits<S>::max());
    fill(dist, dist + n, 0);
    fill(prev, prev + n, (Edge*)NULL);
    mark[source] = true;
    maxc[source] = numeric_limits<S>::max();
    minw[source] = 0;
    q.push(source);
    while (!q.empty()) {
      int cur = q.front();
      mark[cur] = false;
      q.pop();
      for (typename vector<Edge>::iterator it = e[cur].begin();
           it != e[cur].end(); ++it) {
        T c = min(maxc[cur], it->c);
        if (c == 0) {
          continue;
        }
        int v = it->v;
        S w = minw[cur] + it->w;
        if (minw[v] > w || (minw[v] == w && maxc[v] < c)) {
          maxc[v] = c;
          minw[v] = w;
          dist[v] = dist[cur] + 1;
          if (dist[v] >= n) {
            return false;
          }
          prev[v] = &*it;
          if (!mark[v]) {
            mark[v] = true;
            q.push(v);
          }
        }
      }
    }
    return true;
  }
  pair<T, S> gao() {
    T sumc = 0;
    S sumw = 0;
    while (true) {
      if (!_spfa()) {
        throw NegativeCostCircuitExistsException();
      } else if (maxc[sink] == 0) {
        break;
      } else {
        T c = maxc[sink];
        sumc += c;
        sumw += c * minw[sink];
        int cur = sink;
        while (cur != source) {
          Edge* e1 = prev[cur];
          e1->c -= c;
          Edge* e2 = &e[e1->v][e1->b];
          e2->c += c;
          cur = e2->v;
        }
      }
    }
    return make_pair(sumc, sumw);
  }
};
const int MAXN = 2020;
MinCostMaxFlow<MAXN> mcmf;
int n, m, k;
int a[2100];
int ans[2100];
int cnt[2100][2100];
struct node {
  int l, r, w;
} s[2100];
int main() {
  int tt;
  scanf("%d%d", &n, &m);
  int hh = 0, h = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d", &s[i].l, &s[i].r, &s[i].w);
    s[i].r = s[i].l + s[i].r - 1;
    a[h++] = s[i].l;
    a[h++] = s[i].r;
  }
  sort(a, a + h);
  for (int i = 0; i < h; ++i)
    if (i == h - 1 || a[i] != a[i + 1]) a[hh++] = a[i];
  h = hh;
  int sa = 0, t = h + 1;
  mcmf.init(h + 2, sa, t);
  for (int i = 0; i < n; ++i) {
    int l, r;
    for (int j = 0; j < h; ++j) {
      if (a[j] == s[i].l) {
        l = j + 1;
      }
      if (a[j] == s[i].r) {
        r = j + 1;
      }
    }
    mcmf.addEdge(l, r + 1, 1, -s[i].w);
  }
  mcmf.addEdge(sa, 1, m, 0);
  mcmf.addEdge(h, t, m, 0);
  for (int i = 1; i < h; ++i) mcmf.addEdge(i, i + 1, m, 0);
  pair<int, int> an = mcmf.gao();
  for (int i = 0; i < n; ++i) {
    int l, r;
    for (int j = 0; j < h; ++j) {
      if (a[j] == s[i].l) {
        l = j + 1;
      }
      if (a[j] == s[i].r) {
        r = j + 1;
      }
    }
    r++;
    cnt[l][r]++;
    cnt[r][l]++;
    int now = 0;
    for (int j = 0; j < mcmf.e[l].size(); ++j) {
      if (mcmf.e[l][j].v == r) {
        now++;
        if (now == cnt[l][r]) {
          if (mcmf.e[l][j].c == 0) {
            ans[i] = 1;
          } else
            ans[i] = 0;
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d", ans[i]);
    if (i == n - 1)
      puts("");
    else
      printf(" ");
  }
  return 0;
}
