# bzoj 3265

#include <bits/stdc++.h>

const int N = 2e5 + 10;

struct Node {
int x, y, z, ans, id;
bool operator == (Node a) {
return x == a.x && y == a.y && z == a.z;
}
int n, k;

inline void In_put() {
std:: cin >> n >> k;
for(int i = 1; i <= n; i ++) std:: cin >> Ask[i].x >> Ask[i].y >> Ask[i].z;
}

struct Node_1 {

int Tree[N];

inline int Lowbit(int x) {return x & (-x);}

inline void Add(int x, int a) {
if(!x) return ;
while(x <= k) Tree[x] += a, x += Lowbit(x);
}

inline int Ass(int x) {
int ret = 0;
while(x) ret += Tree[x], x -= Lowbit(x);
return ret;
}
} Bit;

inline bool Cmpx(Node a, Node b) {
return a.x < b. x || (a.x == b.x && a.y < b.y) || (a.x == b.x && a.y == b.y && a.z < b.z);
}

inline bool Cmpy(Node a, Node b) {return a.y < b.y;  }

Node a[N], b[N];
int Change[N];

void Cdq(int l, int r) {
if(l >= r) return ;
int mid = (l + r) >> 1;
Cdq(l, mid);
int js_a = 0;
for(int i = l; i <= mid; i ++) a[++ js_a] = Ask[i];
std:: sort(a + 1, a + js_a + 1, Cmpy);
int js_b = 0;
for(int i = mid + 1; i <= r; i ++) b[++ js_b] = Ask[i];
std:: sort(b + 1, b + js_b + 1, Cmpy);
int to_a = 1, to_b = 1, tot = 0;
while(to_b <= js_b) {
while(to_a <= js_a && a[to_a].y <= b[to_b].y) {
Change[++ tot] = a[to_a].z;
++ to_a;
}
++ to_b;
}
for(int i = 1; i <= tot; i ++) Bit.Add(Change[i], -1);
Cdq(mid + 1, r);
}

void Work() {
for(int i = 1; i <= n; i ++) Ask[i].id = i;
Cdq(1, n);
}

int Cnt[N];

for(int i = n - 1; i >= 1; i --)
for(int i = 1; i <= n; i ++) ++ Cnt[Ask[i].ans];
for(int i = 0; i < n; i ++)    std:: cout << Cnt[i] << "\n";
}

int main() {
In_put();
Work();
}