#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  998244353 //1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 100000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int pref[N];
struct SegTree
{

    int tree[4*N];
    int lazy[4*N];
    int clazy[4*N];
    void push(int node,int l,int r)
    {   int mid=(l+r)>>1;
        if(clazy[node])
        {tree[2*node+1]=((pref[mid]-pref[l-1]+M)*lazy[node])%M;
        tree[2*node+2]=((pref[r]-pref[mid]+M)*lazy[node])%M;
        lazy[2*node+1]=lazy[node];
        lazy[2*node+2]=lazy[node];
        clazy[2*node+1]=1;
        clazy[2*node+2]=1;
        clazy[node]=0;
        }

    }
    void build(vector<int>&a,int node,int start,int end)
    {
        if(start == end)
        {
            tree[node]=a[start];
            return;
        }
        int mid=(start + end)>>1;
        build(a,2*node+1,start,mid);
        build(a,2*node+2,mid+1,end);
        tree[node]=(tree[2*node+1]+tree[2*node+2])%M;
    }
    void rupd(int node,int start,int end,int l,int r,int val)
    {   if(r<start || l>end)return;
        if(l<=start && end<=r)
        {
            tree[node]=(((pref[end]-pref[start-1]+M)%M)*val)%M;
            lazy[node]=val;
            clazy[node]=1;
            return;
        }
        push(node,start,end);
        int mid=(start + end)>>1;
        rupd(2*node+1,start,mid,l,r,val);
        rupd(2*node+2,mid+1,end,l,r,val);
        tree[node]=(tree[2*node+1]+tree[2*node+2])%M;

    }
    int pquery(int node,int start,int end,int l,int r)
    {
        if(r<start || l>end)return INF;
        if(l<=start && end<=r)
            return tree[node];
        push(node,start,end);
        int mid=(start+end)>>1;
        int p1=pquery(2*node+1,start,mid,l,r);
        int p2=pquery(2*node+2,mid+1,end,l,r);
        return (p1+p2)%M;
    }
}st;
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,q;
   cin>>n>>q;
   int x=1;
   int sum=1;
   vi a(n+1);
   for(int i=1;i<=n;i++)
   {
       pref[i]=(sum%M);
       sum=(10*sum + 1)%M;
   }
   sum=1;
   for(int i=1;i<=n;i++)
   {
       a[i]=sum;
       sum*=10;
       sum%=M;
   }
   st.build(a,0,1,n);
   while(q--)
   {
       int l,r,v;
       cin>>l>>r>>v;
       int temp_l=l;
       int temp_r=r;
       r=(n-temp_l+1);
       l=(n-temp_r+1);
       st.rupd(0,1,n,l,r,v);
       cout<<st.pquery(0,1,n,1,n)<<endl;
   }

}


Measured memory_bytes: 18868