#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl;
    #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl;
    #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl;
    #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl;
#else
    #define p(x)
    #define p2(x,y)
    #define pp(x)
    #define pv(x)
    #define ppv(x)
#endif
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int maxp = 22;
const ld EPS = 1e-18;
const ll INF = 1e18;
const int MOD = 998244353;
const int N = 2e5+2;

ll power[N];

template<typename T>
struct SEGTREE{
    struct node{
        T val; // for adding more stuff
        T lazy;

        node() : val(0), lazy(0) {}
        node(T _val) : val(_val), lazy(0) {}
    };
    vector<node> seg;
    int N;

    void init(int n){
        N = n;
        seg.assign(4*n,node());
    }

    node merge(node x, node y){
        node res;
        res.val = (x.val + y.val)%MOD;
        return res;
    }

    void push(node &par, node &x, node &y, int s, int mid, int e){
        if(par.lazy==0)return;
        ll r = power[N-s+1];
        ll l = power[N-mid];
        x.val = (((r-l+MOD)%MOD)*par.lazy)%MOD;
        r = power[N-mid];
        l = power[N-e];
        y.val = (((r-l+MOD)%MOD)*par.lazy)%MOD;

        x.lazy = par.lazy;
        y.lazy = par.lazy;

        par.lazy = 0;
    }

    void build(int s, int e, int idx, T arr[]){
        if(s == e){
            seg[idx] = node((arr[s]*((power[N-s+1]-power[N-s]+MOD)%MOD))%MOD);
            return;
        }
        int mid = (s+e)/2;
        build(s,mid,idx*2,arr);
        build(mid+1,e,idx*2+1,arr);
        seg[idx] = merge(seg[idx*2],seg[idx*2+1]);
    }

    // supports 1-indexing
    void build(T arr[]){
        build(1,N,1,arr);
    }

    void update(int s, int e, int idx, int qs, int qe, T val){
        if(qs<=s && e<=qe){
            ll r = power[N-s+1];
            ll l = power[N-e];
            seg[idx].val = (((r-l+MOD)%MOD)*val)%MOD;
            seg[idx].lazy = val;
            return;
        }
        if(s>qe || e<qs)
            return;
        int mid = (s+e)/2;
        push(seg[idx],seg[idx*2],seg[idx*2+1],s,mid,e);
        update(s,mid,idx*2,qs,qe,val);
        update(mid+1,e,idx*2+1,qs,qe,val);
        seg[idx] = merge(seg[idx*2],seg[idx*2+1]);
    }

    // add to all i (l<=i && i<=r) += val
    void update(int l, int r, T val){
        update(1,N,1,l,r,val);
    }

    node query(int s, int e, int idx, int qs, int qe){
        if(qs<=s && e<=qe)
            return seg[idx];
        if(s>qe || e<qs)
            return node();
        int mid = (s+e)/2;
        push(seg[idx],seg[idx*2],seg[idx*2+1],s,mid,e);
        return merge(query(s,mid,idx*2,qs,qe),query(mid+1,e,idx*2+1,qs,qe));
    }

    T query(int l, int r){
        return query(1,N,1,l,r).val;
    }

};


int main(){
fastio

int i;
ll curr = 1;
for(i=1;i<N;i++){
    power[i] = (power[i-1]+curr)%MOD;
    curr = (curr*10)%MOD;
}

int n,q;
cin>>n>>q;

SEGTREE<ll> seg;
seg.init(n);

ll arr[n+1];

for(i=1;i<=n;i++)arr[i] = 1;

seg.build(arr);

//cout<<seg.seg[1].val<<endl;

while(q--){
    int l,r,x;
    cin>>l>>r>>x;
    p(x)
    seg.update(l,r,x);
    cout<<seg.seg[1].val<<endl;
}



}


Measured memory_bytes: 18784