#include #define MOD 998244353ll using namespace std; using ll = long long; ll powmod(ll a, ll n){ ll ret = 1; while(n){ if (n & 1) { ret = ret * a % MOD; } a = a * a % MOD; n >>= 1; } return ret; } const ll INV2 = powmod(2, MOD - 2); int main(void){ ll n, m; cin >> n >> m; vector > mons(n, tuple({})); for(auto&[x, y, d] : mons){ ll x_tmp, y_tmp, h; cin >> x_tmp >> y_tmp >> h; x = x_tmp - y_tmp; y = x_tmp + y_tmp; d = m - h; } vector > imos = {}; for(auto&[x, y, d] : mons){ imos.push_back({x - d, y - d, 1}); imos.push_back({x + d, y - d, -1}); imos.push_back({x - d, y + d, -1}); imos.push_back({x + d, y + d, 1}); } sort(imos.begin(), imos.end()); vector area(n + 1); vector > col_nows = {}; ll x_now = -(ll)1e18; for(auto&[x, y, c] : imos){ if(x_now != x){ sort(col_nows.begin(), col_nows.end()); ll cnt = 0; for(int i = 0; i < (int)col_nows.size() - 1; ++i){ cnt += col_nows[i].second; area[cnt] += (col_nows[i + 1].first - col_nows[i].first) % MOD * (x - x_now) % MOD; } x_now = x; } col_nows.push_back({y, c}); } for(int i = 1; i < n + 1; ++i){ ll ans = area[i] % MOD * INV2 % MOD; cout << ans << endl; } return 0; }