#line 2 "/home/defineprogram/Desktop/Library/template/template.cpp"
#include<bits/stdc++.h>
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<ll,ll>
#define len(s) (ll)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr ll inf = 3e18;
#line 3 "/home/defineprogram/Desktop/Library/structure/SegmentTree.cpp"

template<typename Monoid,typename OperatorMonoid,typename F,typename G,typename H>
class Segtree{
	using size_type=int32_t;
	size_type size=1;
	vector<Monoid>dat;
	vector<OperatorMonoid>lazy;
	const F f;
	const G g;
	const H h;
	Monoid M;
	OperatorMonoid OM;
public:
	void set(size_type a,Monoid x){
		dat[a+size-1]=x;
	}
	/*void init(){
		for(size_type i=size-2;i>=0;i--){
			dat[i]=f(dat[i*2+1],dat[i*2+2]);
		}
	}*/
	void eval(size_type k,size_type l,size_type r){
		if(lazy[k]!=OM){
			dat[k]=g(dat[k],lazy[k],(r-l));
			if(r-l>1){
				lazy[2*k+1]=h(lazy[2*k+1],lazy[k]);
				lazy[2*k+2]=h(lazy[2*k+2],lazy[k]);
			}
			lazy[k]=OM;
		}
	}
	void update(size_type a,size_type b,OperatorMonoid M,size_type k=0,size_type l=0,size_type r=-1){
		if(r==-1)r=size;
		eval(k,l,r);
		if(r<=a||b<=l)return;
		if(a<=l&&r<=b){
			lazy[k]=h(lazy[k],M);
			eval(k,l,r);
			return;
		}
		update(a,b,M,k*2+1,l,(l+r)/2);
		update(a,b,M,k*2+2,(l+r)/2,r);
		dat[k]=f(dat[k*2+1],dat[k*2+2],r-l);
	}
	Monoid query(size_type a,size_type b,size_type k=0,size_type l=0,size_type r=-1){
		if(r==-1)r=size;
		eval(k,l,r);
		if(r<=a||b<=l)return M;
		if(a<=l&&r<=b)return dat[k];
		Monoid lv=query(a,b,k*2+1,l,(l+r)/2);
		Monoid rv=query(a,b,k*2+2,(l+r)/2,r);
		return f(lv,rv,r-l);
	}
	template<class C>
	size_type minLeft(size_type a,size_type b,C &check,Monoid x,size_type k=0,size_type l=0,size_type r=-1){
		if(r==-1)r=size;
		eval(k,l,r);
		if(r<=a||b<=l||!check(dat[k],x))return -1;
		if(r-l==1)return l;
		size_type lv=minLeft(a,b,check,x,k*2+1,l,(l+r)/2);
		if(lv!=-1)return lv;
		return minLeft(a,b,check,x,k*2+2,(l+r)/2,r);
	}
	template<class C>
	size_type maxRight(size_type a,size_type b,C &check,Monoid x,size_type k=0,size_type l=0,size_type r=-1){
		if(r==-1)r=size;
		eval(k,l,r);
		if(r<=a||b<=l||!check(dat[k],x))return -1;
		if(r-l==1)return l;
		size_type rv=maxRight(a,b,check,x,k*2+2,(l+r)/2,r);
		if(rv!=-1)return rv;
		return maxRight(a,b,check,x,k*2+1,l,(l+r)/2);
	}
	Segtree(size_type x,F f,G g,H h,Monoid M,OperatorMonoid OM)
	:f(f),g(g),h(h),M(M),OM(OM){
		while(size<x)size*=2;
		dat.resize(size*2-1,M);
		lazy.resize(size*2-1,OM);
	}
};

/*
@brief Lazy Segment Tree
@docs docs/SegmentTree.md
*/
#line 3 "/home/defineprogram/Desktop/Library/math/modint.cpp"

template<int MOD>
struct mint{
	int32_t n;
	mint():n(0){}
	mint(int x):n(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD){}

	mint &operator+=(const mint &p){
		if((n+=p.n)>=MOD)n-=MOD;
		return *this;
	}
	mint &operator-=(const mint &p){
		if((n+=MOD-p.n)>=MOD)n-=MOD;
		return *this;
	}
	mint &operator*=(const mint &p){
		n=1ll*n*p.n%MOD;
		return *this;
	}
	mint &operator/=(const mint &p){
		*this*=p.inverse();
		return *this;
	}
	mint operator-()const{return mint(-n);}
	mint operator+(const mint &p)const{return mint(*this)+=p;}
	mint operator-(const mint &p)const{return mint(*this)-=p;}
	mint operator*(const mint &p)const{return mint(*this)*=p;}
	mint operator/(const mint &p)const{return mint(*this)/=p;}
	bool operator==(const mint &p)const{return n==p.n;}
	bool operator!=(const mint &p)const{return n!=p.n;}

	friend ostream &operator<<(ostream &os,const mint &p){
		return os<<p.n;
	}
	friend istream &operator>>(istream &is,mint &p){
		int x;is>>x;
		p=mint(x);
		return is;
	}
	mint pow(int64_t x)const{
		mint res(1),mul(n);
		while(x>0){
			if(x&1)res*=mul;
			mul*=mul;
			x>>=1;
		}
		return res;
	}
	mint inverse()const{
		return pow(MOD-2);
	}
};
/*
@brief mod int
@docs docs/modint.md
*/
#line 4 "main.cpp"

using modint=mint<998244353>;

modint ele[200005];
auto f=[](modint a,modint b,int sz)->modint{return a*modint(10).pow(sz/2)+b;};
auto g=[](modint a,int b,int sz)->modint{return ele[sz]*modint(b);};
auto h=[](int a,int b)->int{return b;};
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    REP(i,200005)ele[i]=ele[i-1]*10+modint(1);
    int N,Q;
    cin>>N>>Q;
    Segtree<modint,int,decltype(f),decltype(g),decltype(h)>segtree(N,f,g,h,0,0);
    rep(i,N)segtree.update(i,i+1,1);
    int nex2=1;
    while(nex2<N)nex2*=2;
    rep(i,Q){
        int L,R,D;cin>>L>>R>>D;L--;
        segtree.update(L,R,D);
        cout<<segtree.query(0,N)/modint(10).pow(nex2-N)<<"\n";
    }
}


Measured memory_bytes: 8232