n,m=map(int,input().split()) M=998244353 p=[] zx=[10**10] zy=[10**10] for i in range(n): x,y,h=map(int,input().split()) p+=[(x-y,x+y,m-h)] zx+=[x-y-m+h] zx+=[x-y+m-h] zy+=[x+y-m+h] zy+=[x+y+m-h] zx=list(sorted(set(zx))) dx={v:i for i,v in enumerate(zx)} zy=list(sorted(set(zy))) dy={v:i for i,v in enumerate(zy)} q=[[0]*(len(zy)+1) for i in range(len(zx)+1)] for x,y,l in p: q[dx[x-l]][dy[y-l]]+=1 q[dx[x+l]][dy[y-l]]-=1 q[dx[x-l]][dy[y+l]]-=1 q[dx[x+l]][dy[y+l]]+=1 a=[0]*(n+1) for i in range(len(zx)-1): for j in range(len(zy)-1): q[i][j]+=q[i-1][j]+q[i][j-1]-q[i-1][j-1] a[q[i][j]]+=(zx[i+1]-zx[i])*(zy[j+1]-zy[j])%M a[q[i][j]]%=M for v in a[1:]: print(v*pow(2,M-2,M)%M)