#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define printa(a, L, R)         \
    for (int i = L; i < R; i++) \
    cout << a[i] << (i == R - 1 ? '\n' : ' ')
#define printv(a) printa(a, 0, a.size())
#define print2d(a, r, c)            \
    for (int i = 0; i < r; i++)     \
        for (int j = 0; j < c; j++) \
    cout << a[i][j] << (j == c - 1 ? '\n' : ' ')
#define pb push_back
#define eb emplace_back
#define UB upper_bound
#define LB lower_bound
#define F first
#define S second
#define mem(a, x) memset(a, x, sizeof(a))
#define inf 1e18
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r, n) (int)(log2(n) / log2(r))
#define rev(v) reverse(v.begin(), v.end())
#define srt(v) sort(v.begin(), v.end())
#define grtsrt(v) sort(v.begin(), v.end(), greater<ll>())
#define all(v) v.begin(), v.end()
#define mnv(v) *min_element(v.begin(), v.end())
#define mxv(v) *max_element(v.begin(), v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)), v.end())
#define fout(x) fixed << setprecision(x)

const ll mod = 998244353;
const ll N = 3e5 + 9;
const ld eps = 1e-9;
const ld PI = acos(-1.0);
ll gc(ll a, ll b)
{
    while (b)
    {
        ll x = a % b;
        a = b;
        b = x;
    }
    return a;
}
ll lc(ll a, ll b) { return a / gc(a, b) * b; }
ll qpow(ll n, ll k)
{
    ll ans = 1;
    assert(k >= 0);
    n %= mod;
    while (k > 0)
    {
        if (k & 1)
            ans = (ans * n) % mod;
        n = (n * n) % mod;
        k >>= 1;
    }
    return ans % mod;
}

#define MX 300000LL

ll t[4*MX], vl[4*MX], marked[4*MX];

void push(ll v)
{
    if(marked[v])
    {
        marked[2*v]=marked[2*v+1]=marked[v];
        t[2*v]=vl[2*v]*marked[2*v];
        t[2*v+1]=vl[2*v+1]*marked[2*v+1];
        marked[v]=0;
    }
}

void update(ll v, ll tl, ll tr, ll l, ll r, ll new_val) {
    if (l > r) 
        return;
    if (l == tl && tr == r) {
        t[v] = (new_val*vl[v])%mod;
        marked[v] = new_val;
    } else {
        push(v);
        ll tm = (tl + tr) / 2;
        update(v*2, tl, tm, l, min(r, tm), new_val);
        update(v*2+1, tm+1, tr, max(l, tm+1), r, new_val);
        t[v]=(t[2*v]+t[2*v+1])%mod;
    }
}

void build(vll &a, ll v, ll tl, ll tr) {
    if (tl == tr) {
        vl[v] = a[tl];
    } else {
        ll tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        vl[v] = (vl[v*2] + vl[v*2+1])%mod;
    }
}

void solve()
{

    ll n, q;
    cin>>n>>q;
    vll v(n+1);
    ll an=1;
    v[n]=1;
    for(ll i=n-1;i>0;i--)
    {
        an=(an*10)%mod;
        v[i]=an;
    }
    build(v, 1, 1, n);
    update(1, 1, n, 1, n, 1);
    // cout<<t[1]<<endl;
    while(q--)
    {
        ll l, r, d;
        cin>>l>>r>>d;
        update(1, 1, n, l, r, d);
        cout<<t[1]<<nl;
    }
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 17212