#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, 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;
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//const int mod=1000000007;
const int mod=998244353;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
ll n,m;
struct item
{
    ll sum,org,op;//op is the numbers in the segment
};

struct segtree{
    int size;
    vector<item> values;
    ll NO_OPERATION=LLONG_MAX;
    item NEUTRAL_ELEMENT={0,0,NO_OPERATION};
    void apply_operation(item & a)
    {
        if(a.op!=NO_OPERATION)
            a.sum=(a.org*a.op)%mod;
    }
    int merge(item a,item b)
    {
        ll ans=0;
        return  (((a.sum)%mod+(b.sum)%mod)%mod);
        
    }
    item single(int v,int lx)
    {
        return {powerm(10,lx),powerm(10,lx),v};
    }
    void init(int n2)
    {
        size=1;
        while(size<=n2)size*=2;
        values.resize(2*size);
    }
    void build(VL &arr,int x,int lx,int rx)//build
    {
        if(rx-lx==1)
        {
            if(lx<arr.size())
            {
                values[x]=single(arr[lx],n-1-lx);
            }
            else
                values[x]=NEUTRAL_ELEMENT;
            return;
        }
        int m=(lx+rx)>>1;
        build(arr,2*x+1,lx,m);
        build(arr,2*x+2,m,rx);
        values[x].sum=merge(values[2*x+1],values[2*x+2]);
        values[x].org=values[x].sum;
        values[x].op=NO_OPERATION;
        return;
    }
    void build(VL & arr)//build
    {
        build(arr,0,0,size);
    }
    
    void propogate(ll x,ll lx,ll rx)
    {
        if(rx-lx==1)return;
        if(values[x].op==NO_OPERATION)
            return;
        values[2*x+1].op=values[x].op;
        values[2*x+2].op=values[x].op;
        apply_operation(values[2*x+1]);
        apply_operation(values[2*x+2]);
        values[x].op=NO_OPERATION;
        values[x].sum=merge(values[2*x+1],values[2*x+2]);
     
        return;
    }
    void set(ll l,ll r,ll v,ll x,ll lx,ll rx)
    {
        
        if(lx>=r||l>=rx)return ;
        if(lx>=l&&rx<=r){
            //propogate(x,lx,rx);
            values[x].op=v;
            apply_operation(values[x]);
  
            return ;
        }
        if(values[x].op!=NO_OPERATION)
            propogate(x,lx,rx);
        int m=(lx+rx)>>1;
        set(l,r,v,2*x+1,lx,m);
        set(l,r,v,2*x+2,m,rx);
        values[x].sum=merge(values[2*x+1],values[2*x+2]);
        if(values[x].op!=NO_OPERATION)
        {
            apply_operation(values[x]);
        }

        return;
    }
    void set(ll l,ll r,ll v)
    {
        set(l,r,v,0,0,size);
    }
   
    ll calc(ll l,ll r,ll x,ll lx,ll rx)
    {
        
        if(lx>=r||l>=rx)return 0LL;
        if(lx>=l&&rx<=r){
            //apply_operation(values[x]);
            return values[x].sum;
        }
        // if(values[x].op!=NO_OPERATION)
        //     propogate(x,lx,rx);
        int m=(lx+rx)>>1;
        ll ans=(calc(l,r,2*x+1,lx,m)+calc(l,r,2*x+2,m,rx))%mod;
        if(values[x].op!=NO_OPERATION)
        {
            //apply_operation(values[x]);
            return values[x].sum;
        }
        return ans;
    }
    ll calc(ll l,ll r)
    {
        //return calc(l,r,0,0,size);
        //apply_operation(values[0]);
        return values[0].sum;
    }
    void display(ll x,ll lx,ll rx)
    {
        if(rx-lx==1)
        {
            cout<<x+1<<" "<<values[x].sum<<"\n";
            return;
        }
        cout<<x+1<<" "<<values[x].sum<<"\n";
        ll m=(lx+rx)>>1;
        display(2*x+1,lx,m);
        display(2*x+2,m,rx);
        
    }
    void display()
    {
        // fr(i,0,2*size)
        //     cout<<values[i].sum<<" ";
        // cout<<"\n";
        display(0,0,size);
    }
    
};
void solve()
{
    
    cin>>n>>m;
    segtree st;
    st.init(n);
    VL arr(n,1);
    cout<<"\n";
    st.build(arr);
    ///st.display();
    //cout<<st.calc(0,n)<<endl;
    fr(j,0,m)
    {
        ll l,r,d;
        cin>>l>>r>>d;
        st.set(l-1,r,d);
        //cout<<"ok\n";
        //st.display();
        cout<<st.calc(0,n)<<endl;
       
    }
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        //cout<<"Case #"<<pp-t<<":\n";
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
/*
recursion - matrix exponential

*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 17188