#include using namespace std; using namespace atcoder; using ll = long long; const ll MOD = 1'000'000'000'000'000'009ll; using S = pair; using F = pair; S e(){return S({0, 0});} S op(S l, S r) { return make_pair(l.first + r.first, l.second + r.second); } S mapping(F f, S x) { return make_pair(x.first * f.first + x.second * f.second, x.second); } F composition(F f, F g) { return make_pair(f.first * g.first, g.second * f.first + f.second); } F id() {return make_pair(1, 0); } void add(ll &x, ll y){ x += y; while(x >= MOD)x -= MOD; } int main(){ ios::sync_with_stdio(false); cin.tie(0); ll N, l, r; int Q, cmd; cin >> N >> Q; vector> query(Q); vector ca = {0, N}; for(int i = 0; i < Q; i++){ cin >> cmd >> l >> r; r++; query[i] = make_tuple(cmd, l, r); ca.push_back(l); ca.push_back(r); } sort(ca.begin(), ca.end()); ca.erase(unique(ca.begin(), ca.end()), ca.end()); vector temp(ca.size(), make_pair(0, 0)); for(int i = 0; i + 1 < ca.size(); i++){ temp[i].second = ca[i + 1] - ca[i]; } vector> seg(5, lazy_segtree(temp)); array score{}, temp2{}; for(int i = 0; i < Q; i++){ tie(cmd, l, r) = query[i]; l = lower_bound(ca.begin(), ca.end(), l) - ca.begin(); r = lower_bound(ca.begin(), ca.end(), r) - ca.begin(); if(cmd == 0){ for(int i = 0; i < 5; i++){ temp2[i] = seg[i].prod(l, r).first; } auto it = max_element(temp2.begin(), temp2.end()); if(count(temp2.begin(), temp2.end(), *it) >= 2)continue; add(score[it - temp2.begin()], *it); }else{ cmd--; for(int i = 0; i < 5; i++){ if(i == cmd)seg[i].apply(l, r, {1, 1}); else seg[i].apply(l, r, {0, 0}); } } } for(int i = 0; i < 5; i++){ add(score[i], seg[i].all_prod().first); cout << score[i] << (i + 1 == 5 ? '\n' : ' '); } }