//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word

#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=200005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
int st[4*N], lazy[4*N], n, dp[4*N][10],po[N];
void propogate(int node, int l, int r)
{
    if(l!=r)
    {
        lazy[node*2]=lazy[node];
        lazy[node*2+1]=lazy[node];
    }
    st[node]=dp[node][lazy[node]];
    lazy[node]=-1;
}
void update(int node, int l, int r, int x, int y, int d)
{
    if(lazy[node]!=-1)
    propogate(node, l, r);
    if(y<x||x>r||y<l)
    return;
    if(l>=x&&r<=y)
    {
        st[node]=dp[node][d];
        if(l!=r)
        {
            lazy[node*2]=d;
            lazy[node*2+1]=d;
        }
        return;
    }
    int mid=(l+r)/2;
    update(node*2, l, mid, x, y, d);
    update(node*2+1, mid+1, r, x, y, d);
    st[node]=(st[node*2]+st[node*2+1])%mod;
    return;
}
int query(int node, int l, int r, int x, int y)
{
    if(lazy[node]!=-1)
    propogate(node, l, r);
    if(y<x||y<l||x>r)
    return 0;
    if(l>=x&&r<=y)
    return st[node];
    int mid=(l+r)/2;
    return (query(node*2, l, mid, x, y)+query(node*2+1, mid+1, r, x, y))%mod;
}
void pree()
{
    int mul=1;
    for(int i=n;i>0;i--)
    {
        po[i]=mul;
        mul=(mul*10ll)%mod;
    }
    return;
}
void pre(int v, int l, int r, int d)
{
    if(l==r)
    {
        dp[v][d]=(po[l]*d)%mod;
        return;
    }
    int m=(l+r)/2;
    pre(v*2, l, m, d);
    pre((v*2)+1, m+1, r, d);
    dp[v][d]=(dp[v*2][d]+dp[(v*2)+1][d])%mod;
    return;
}
int32_t main()
{
    IOS;
    int q;
    cin>>n>>q;
    pree();
    for(int i=0;i<10;i++)
    pre(1, 1, n, i);
    fill(lazy, -1);
    update(1, 1, n, 1, n, 1);
    while(q--)
    {
        int l,r,d;
        cin>>l>>r>>d;
        update(1, 1 ,n, l, r, d);
        cout<<query(1, 1, n, 1, n)<<"\n";
    }
}

Measured memory_bytes: 56448