#include<bits/stdc++.h>
using namespace std;

//typedef
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef tuple<LL, LL, LL> TLL3;
typedef tuple<LL, LL, LL, LL> TLL4;
typedef set<LL, greater<LL> > setdownLL;
#define PQ priority_queue
typedef PQ<LL, vector<LL>, greater<LL> > pqupLL;
//container utill
#define ALL(v) (v).begin(),(v).end()
#define CR [](auto element1, auto element2){return element1>element2;}
#define LB lower_bound
#define UP upper_bound
#define PB push_back
#define MP make_pair
#define MT make_tuple
//constant
#define PI 3.141592653589793

const int MOD=998244353;
LL jupow[200001];
LL jupowsum[200001];

template<class Abel> struct STLP{//[0,STLP.n)
    vector<Abel> dat,lazy_val;
    vector<bool> lazy;
    long long n, n_ori;
    Abel unity;

    STLP(long long n_origin, Abel SUM_UNITY){
        n_ori=n_origin;
        unity=SUM_UNITY;
        long long i=0;
        while(n_origin>(1<<i)) i++;
        n = (1<<i);
        dat.resize(2*n -1);
        lazy_val.resize(2*n-1);
        lazy.resize(2*n-1);
        for(i=0; i< 2*n -1; i++){
            dat[i]=SUM_UNITY;
            lazy_val[i]=SUM_UNITY;
            lazy[i]=0;
        }
    }

    void eval(long long k, long long l, long long r){
        if(lazy[k]==1){
            if(r<n_ori){
                dat[k]=lazy_val[k]*(jupowsum[n_ori-1-l]+(MOD-jupowsum[n_ori-1-r]));
                dat[k]%=MOD;
            }else{
                dat[k]=lazy_val[k]*jupowsum[n_ori-1-l];
                dat[k]%=MOD;
            }
            if(r-l>1){
                lazy[k*2+1]=1;
                lazy[k*2+2]=1;
                lazy_val[k*2+1]=lazy_val[k];
                lazy_val[k*2+2]=lazy_val[k];
            }
            lazy[k]=0;
            lazy_val[k]=unity;
        }
    }

    void update_range(Abel x, long long a, long long b, long long k, long long l, long long r){//[a,b)
        eval(k,l,r);
        if(r<=a||b<=l) return;
        if(a<=l&&r<=b){
            lazy[k]=1;
            lazy_val[k]=x;
            eval(k,l,r);
            return;
        }
        update_range(x,a,b,k*2+1, l, (l+r)/2);
        update_range(x,a,b,k*2+2, (l+r)/2, r);
        dat[k]=dat[k*2+1]+dat[k*2+2];
        dat[k]%=MOD;
        return;
    }

    Abel sum_range(long long a, long long b, long long k, long long l, long long r){//[a,b)
        eval(k,l,r);
        if(r<=a||b<=l) return unity;
        if(a<=l&&r<=b) return dat[k];
        Abel vl=sum_range(a,b,k*2 +1, l, (l+r)/2);
        Abel vr=sum_range(a,b,k*2 +2, (l+r)/2, r);
        return (vl+vr)%MOD;
    }
};


int main(){
    int i;
    jupow[0]=1;
    for(i=1; i<=200000; i++){
        jupow[i]=10*jupow[i-1];
        jupow[i]%=MOD;
    }
    jupowsum[0]=1;
    for(i=1; i<=200000; i++){
        jupowsum[i]=jupow[i]+jupowsum[i-1];
        jupowsum[i]%=MOD;
    }

    int N,Q;
    cin >> N >> Q;
    STLP<LL> tre(N,0);
    tre.update_range(1,0,N,0,0,tre.n);
    int L,R,D;
    for(i=0; i<Q; i++){
        cin >> L >> R >> D;
        L--;
        R--;
        tre.update_range(D,L,R+1,0,0,tre.n);
        cout << tre.sum_range(0,N,0,0,tre.n) << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 14628