#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<bits/stdc++.h>
using namespace std;
std::mt19937 rnd(time(0));//std::mt19937_64 rnd(time(0));
namespace Sakurajima_Mai{
	#define si(a) scanf("%d",&a)
	#define sl(a) scanf("%lld",&a)
	#define sd(a) scanf("%lf",&a)
	#define ss(a) scanf("%s",a)
	#define ms(a) memset(a,0,sizeof(a))
	#define reg register
	#define repi(i,a,b) for(reg int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
	#define repd(i,a,b) for(reg int i=a,bbb=b;i>=bbb;--i)
	#define reps(s) for(reg int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
	#define ce(i,r) i==r?'\n':' '
	#define pb push_back 
	#define all(x) x.begin(),x.end()
	#define gmn(a,b) a=min(a,b)
	#define gmx(a,b) a=max(a,b)
	#define fi first
	#define se second
//	#define pr(x) cout<<#x<<": "<<x<<endl
	typedef long long ll;
	typedef unsigned long long ull;
	typedef double db;
	const int infi=2e9;
	const ll infl=4e18;
	inline int qi(){
    int f=0,fu=1; char c=getchar();
    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
    return f*fu;
	}
	inline ll ql(){
		ll f=0;int fu=1; char c=getchar();
	    while(c<'0'||c>'9'){ if(c=='-')fu=-1; c=getchar(); }
	    while(c>='0'&&c<='9'){ f=(f<<3)+(f<<1)+c-48; c=getchar(); }
	    return f*fu;
	}
	inline db qd(){
	    char c=getchar();int flag=1;double ans=0;
	    while((!(c>='0'&&c<='9'))&&c!='-') c=getchar();
	    if(c=='-') flag=-1,c=getchar();
	    while(c>='0'&&c<='9') ans=ans*10+(c^48),c=getchar();
	    if(c=='.'){c=getchar();for(register int Bit=10;c>='0'&&c<='9';Bit=(Bit<<3)+(Bit<<1)) ans+=(double)(c^48)*1.0/Bit,c=getchar();}
	    return ans*flag;
	}
	inline ll ceil_div(ll a,ll b){ return (a+b-1)/b; }
}
using namespace Sakurajima_Mai;
const int MAX_N=2e5+5;
const int mod=998244353;
int p[MAX_N],ps[MAX_N];
struct node{ int l,r,len,sum,lazy; };
struct SegTree{//?????
	#define kl k<<1
	#define kr k<<1|1
	node tr[MAX_N<<2];
	void pushup(int k)
	{ 
		tr[k].sum=(1ll*tr[kl].sum*p[tr[kr].len]%mod+tr[kr].sum)%mod;
	}
	void pushdown(int k)
	{
		if(!tr[k].lazy) return ;
		tr[kl].sum=1ll*tr[k].lazy*ps[tr[kl].len-1]%mod;
		tr[kr].sum=1ll*tr[k].lazy*ps[tr[kr].len-1]%mod;
		tr[kl].lazy=tr[k].lazy,tr[kr].lazy=tr[k].lazy,tr[k].lazy=0;
	}
	void build(int k,int l,int r)
	{
		tr[k].l=l,tr[k].r=r,tr[k].len=r-l+1,tr[k].lazy=0;
		if(l==r) { tr[k].sum=1; return; }
		int mid=(l+r)>>1; build(kl,l,mid),build(kr,mid+1,r); pushup(k);
	}
	void update_interval(int k,int l,int r,int val)//????
	{
		if(l<=tr[k].l&&tr[k].r<=r){ 
			tr[k].sum=1ll*ps[tr[k].len-1]*val%mod,tr[k].lazy=val;
			return;
		}
		pushdown(k);
		int mid=(tr[k].l+tr[k].r)>>1;
		if(l<=mid) update_interval(kl,l,r,val);
		if(r>mid) update_interval(kr,l,r,val);
		pushup(k);
	} 	
	int query_interval(int k,int l,int r)//????
	{
		if(l<=tr[k].l&&tr[k].r<=r) return tr[k].sum;
		pushdown(k);
		int mid=(tr[k].l+tr[k].r)>>1;
		int ans=0;
		if(l<=mid) ans=query_interval(kl,l,r);
		if(r>mid) ans=(1ll*ans*p[tr[kl].len]%mod+query_interval(kr,l,r))%mod;
		return ans;
	}
}Tr;

int main()
{
	p[0]=1,ps[0]=1;
	repi(i,1,200001) p[i]=1ll*10*p[i-1]%mod,ps[i]=(1ll*ps[i-1]+p[i])%mod;
	int n=qi(),q=qi();
	Tr.build(1,1,n);
	int ans=Tr.query_interval(1,1,n); 
	while(q--){
		int l=qi(),r=qi(),d=qi();
		Tr.update_interval(1,l,r,d);
		int ans=Tr.query_interval(1,1,n);
		printf("%d\n",(ans%mod+mod)%mod);
	}
	return 0;
}

Measured memory_bytes: 15528