#include<bits/stdc++.h>
#include <complex>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace  std;

#define ll long long
#define ull unsigned long long
#define f first
#define s second
typedef pair<int , int > pii;
typedef pair<ll,ll> pll;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

const ll MOD = 998244353;

void min_self(ll &a , ll b){a=min(a,b);}
void max_self(ll &a, ll b){a=max(a,b);}
ll add(ll x, ll y){return (x + y) % MOD;}
ll sub(ll x, ll y){return add(x, MOD - y);}
ll mul(ll x, ll y){return (x * 1ll * y) % MOD;}
ll binpow(ll x, ll y)
{   ll z = 1;
    while(y > 0)
    {if(y % 2 == 1) z = mul(z, x);
        x = mul(x, x);
        y /= 2;
    }
    return z;
}
ll inv(ll x){return binpow(x, MOD - 2);}
const int MXN = 1e6+10;
ll fact[MXN];
void fac_pre()
{
    fact[0]=1;
    for(ll i=1; i<MXN; i++){
        fact[i]=mul(fact[i-1],i);
    }
}
ll C(ll n, ll k)
{   if(n<0 || k<0) return 0;
    if(k>n) return 0;
    return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}
///--//

// Change lazy updates as per requirement
struct dat
{
    //Use required attributes
    int val;

    //Default Values
    dat() : val(0) {};
    int get_val(){
        return val;
    }
};

struct SegTree
{
    int N;
    vector<dat> st;
    vector<bool> cLazy;
    vector<int> lazy;
    vector<int> m_pow;
    vector<int> cof;
    void init(int n)
    {
        N = n;
        st.resize(4 * N + 5);
        cLazy.assign(4 * N + 5, false);
        lazy.assign(4 * N + 5, 0);
        cof.assign(4*N+5,0);
        m_pow.assign(N+5,0);
        m_pow[n]=1;
        for(int i=n-1; i>=1; i--){
            m_pow[i]=mul(m_pow[i+1],10);
        }
    }

    //Write reqd merge functions
    void merge(dat &cur, dat &l, dat &r)
    {
        cur.val=add(l.val,r.val);
    }

    //Handle lazy propagation appriopriately
    void propagate(int node, int L, int R)
    {
        if(L != R)
        {
            cLazy[node*2] = 1;
            cLazy[node*2 + 1] = 1;
            lazy[node*2] = lazy[node];
            lazy[node*2 + 1] = lazy[node];
        }
        st[node].val = mul(cof[node],lazy[node]);
        cLazy[node] = 0;
    }

    void build(int node, int L, int R)
    {
        if(L==R)
        {
            cof[node]=m_pow[L];
            st[node].val = m_pow[L];
            return;
        }
        int M=(L + R)/2;
        build(node*2, L, M);
        build(node*2 + 1, M + 1, R);
        cof[node]=add(cof[node*2],cof[node*2+1]);
        merge(st[node], st[node*2], st[node*2+1]);
    }

    dat Query(int node, int L, int R, int i, int j)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(j<L || i>R)
            return dat();
        if(i<=L && R<=j)
            return st[node];
        int M = (L + R)/2;
        dat left=Query(node*2, L, M, i, j);
        dat right=Query(node*2 + 1, M + 1, R, i, j);
        dat cur;
        merge(cur, left, right);
        return cur;
    }


    void Update(int node, int L, int R, int i, int j, int val)
    {
        if(cLazy[node])
            propagate(node, L, R);
        if(j<L || i>R)
            return;
        if(i<=L && R<=j)
        {
            cLazy[node] = 1;
            lazy[node] = val;
            propagate(node, L, R);
            return;
        }
        int M = (L + R)/2;
        Update(node*2, L, M, i, j, val);
        Update(node*2 + 1, M + 1, R, i, j, val);
        merge(st[node], st[node*2], st[node*2 + 1]);
    }


    dat query(int l, int r)
    {
        return Query(1, 1, N, l, r);
    }



    void update(int l, int r, int val)
    {
        Update(1, 1, N, l, r, val);
    }
};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen ("output.txt","w",stdout);
    /* KEEP IN MIND
     * take care when sorting a 1 based indexed vector
     * use greater<ll> for ll's
    */

    
    int n,q; cin>>n>>q;
    SegTree st;
    st.init(n);
    st.build(1,1,n);
    while(q--){
        int l,r,d; cin>>l>>r>>d;
        st.update(l,r,d);
        int ans=st.query(1,n).get_val();
        cout<<ans<<endl;
    }
    return 0;


}

Measured memory_bytes: 13428