//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

using mint = modint998244353;

struct F {
    int c;
    int org_weight;
};

string op(string l, string r) { return l + r; }

string e() { return "1"; }

string mapping(F l, string r) { return (l.org_weight ? r : to_string(l.c)); }

F composition(F l, F r) { return F{l.c * (!l.org_weight) + r.c * l.org_weight, l.org_weight * r.org_weight}; }

F id() { return F{1, 1}; }

int main() {
    int N, Q;
    cin >> N >> Q;
    lazy_segtree<string, op, e, F, mapping, composition, id> seg(N);
    rep(i,0,Q) {
        int L, R, D;
        cin >> L >> R >> D;
        seg.apply(L-1, R, F{D, 0});
        cout << stoi(seg.all_prod()) << endl;
    }
}