#include<bits/stdc++.h>
#define maxn 100006
#define maxm 200006
#define lowbit(x) (x&-x)
using namespace std;
inline char nc(){
static char buf[100000],*i=buf,*j=buf;
return i==j&&(j=(i=buf)+fread(buf,1,100000,stdin),i==j)?EOF:*i++;
}
inline int _read(){
char ch=nc();int sum=0;
while(!(ch>='0'&&ch<='9'))ch=nc();
while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
return sum;
}
struct point{
int x,y,z,p;
bool operator ==(const point&b)const{return x==b.x&&y==b.y&&z==b.z;}//等
bool operator <(const point&b)const{return y<b.y||(y==b.y&&z<b.z);}//二三维偏序
}a[maxn],c[maxn];
int n,m,ans[maxn];
bool cmp(point x,point y){return x.x<y.x||(x.x==y.x&&(x.y<y.y||(x.y==y.y&&x.z<y.z)));}
//树状数组
int opt[maxm];
void put(int x,int y){for(;x<=m;x+=lowbit(x))opt[x]+=y;}
int get(int x){
int sum=0;
for(;x;x-=lowbit(x))sum+=opt[x];
return sum;
}
void clear(int x){for(;x<=m;x+=lowbit(x))opt[x]=0;}
void cdq(int l,int r){
if(l>=r)return;//退出
int mid=(l+r)>>1;
cdq(l,mid);cdq(mid+1,r);//分
int i=l;
for(int j=mid+1;j<=r;j++){
while(i<=mid&&a[i].y<=a[j].y)put(a[i].z,1),i++;//a.z++
a[j].p+=get(a[j].z);// p += [0,a.z]
}
for(int i=l;i<=mid;i++)clear(a[i].z);//树状数组清空
for(int i=l;i<=r;i++)c[i]=a[i];// c = a[i]
i=l;int j=mid+1;
for(int k=l;k<=r;k++) if(j>r||((i<=mid&&c[i]<c[j])))a[k]=c[i++];
else a[k]=c[j++];
}
int main(){
freopen("cdq.in","r",stdin);
freopen("cdq.out","w",stdout);
n=_read();m=_read();//读入
for(int i=1;i<=n;i++) a[i].x=_read(),a[i].y=_read(),a[i].z=_read();//读入
sort(a+1,a+1+n,cmp);//1,2,3,关键字排序
cdq(1,n);
sort(a+1,a+1+n,cmp);
int i=1;
while(i<=n){
int j=i,Max=0;
while(j<=n&&a[i]==a[j])Max=max(Max,a[j++].p);
ans[Max]+=j-i;i=j;
}
for(int i=0;i<n;i++)printf("%d
",ans[i]);
return 0;
}