#include #include using namespace std; using namespace atcoder; using mint = modint998244353; const int mod = 998244353; //using mint = modint1000000007; //const int mod = 1000000007; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } template struct value_compression : std::vector { bool built = false; using VS = std::vector; using VS::VS; value_compression(std::vector v = {}) : std::vector(move(v)) {} void build() { std::sort(this->begin(), this->end()); this->erase(unique(this->begin(), this->end()), this->end()); built = true; } template void convert(T first, T last) { assert(built); for (; first != last; ++first) *first = (*this)(*first); } int operator()(S x) { assert(built); return lower_bound(this->begin(), this->end(), x) - this->begin(); } void clear() { this->clear(); built = false; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; struct S { long long xl, xr, yl, yr; }; vectorvs(n); rep(i, n) { long long x, y, h; cin >> x >> y >> h; long long d = m - h; vs[i] = { x - y - d, x - y + d, x + y - d, x + y + d }; } value_compressionvcx, vcy; for (auto e : vs) { vcx.emplace_back(e.xl); vcx.emplace_back(e.xr); vcy.emplace_back(e.yl); vcy.emplace_back(e.yr); } vcx.build(); vcy.build(); int h = vcx.size(); int w = vcy.size(); vector d(h, vector(w)); for (auto e : vs) { auto xl = vcx(e.xl); auto xr = vcx(e.xr); auto yl = vcy(e.yl); auto yr = vcy(e.yr); d[xl][yl]++; d[xr][yl]--; d[xl][yr]--; d[xr][yr]++; } rep(i, h)rep(j, w - 1)d[i][j + 1] += d[i][j]; rep(i, h - 1)rep(j, w)d[i + 1][j] += d[i][j]; vectorans(n + 1); mint inv2 = mint(2).inv(); rep(i, h)rep(j, w) { if (d[i][j])ans[d[i][j]] += inv2 * (vcx[i + 1] - vcx[i]) * (vcy[j + 1] - vcy[j]); } rep2(i, 1, n + 1)cout << ans[i].val() << endl; return 0; }