#include<bits/stdc++.h>

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scanf("%c",&a)
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

const int N = 2e5 + 10, MOD = 998244353;

ll qpow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n) {
        if (n & 1) res = (res * x) % mod;
        x = x * x % mod, n >>= 1;
    }
    return res;
}

ll P[N], S[N];

struct Seg_Tree {
    struct T {
        int l, r;
        ll ans, add;
    } t[N * 4];

    void build(int p, int l, int r) {
        t[p].l = l, t[p].r = r;
        if (l == r)return t[p].ans = P[l], void();
        int mid = (l + r) >> 1;
        build(p << 1, l, mid);
        build(p << 1 | 1, mid + 1, r);
        t[p].ans = (t[p << 1].ans + t[p << 1 | 1].ans) % MOD;
    }

    void spread(int p) {
        if (t[p].add) {
            t[p << 1].ans = (t[p].add * (S[t[p << 1].r] - S[t[p << 1].l - 1] + MOD)) % MOD;
            t[p << 1 | 1].ans = (t[p].add * (S[t[p << 1 | 1].r] - S[t[p << 1 | 1].l - 1] + MOD)) % MOD;
            t[p << 1].add = t[p].add;
            t[p << 1 | 1].add = t[p].add;
            t[p].add = 0;
        }
    }

    void change(int p, int l, int r, int c) {
        //if (t[p].r < l || t[p].l > r)return;
        if (l <= t[p].l && t[p].r <= r) {
            t[p].add = c;
            t[p].ans = c * (S[t[p].r] - S[t[p].l - 1] + MOD) % MOD;
            return;
        }
        spread(p);
        int mid = (t[p].l + t[p].r) >> 1;
        if (l <= mid)change(p << 1, l, r, c);
        if (r > mid)change(p << 1 | 1, l, r, c);
        t[p].ans = (t[p << 1].ans + t[p << 1 | 1].ans) % MOD;
    }

    int ask(int p, int l, int r) {
        if (l <= t[p].l && r >= t[p].r)return t[p].ans;
        spread(p);
        int mid = (t[p].l + t[p].r) >> 1;
        ll val = 0;
        if (l <= mid)val += ask(p << 1, l, r);
        if (r > mid)val += ask(p << 1 | 1, l, r);
        return val % MOD;
    }
} tr;

int n, q;

int main() {
    n = qr(), q = qr();
    P[1] = 1;
    repi(i, 2, n)P[i] = P[i - 1] * 10 % MOD;
    repi(i, 1, n)S[i] = (S[i - 1] + P[i]) % MOD;
    tr.build(1, 1, n);
    while (q--) {
        int l = qr(), r = qr(), v = qr();
        tr.change(1, n - r + 1, n - l + 1, v);
        pl(tr.t[1].ans);
    }
    return 0;
}

Measured memory_bytes: 19144