// @iamnifer
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <iomanip>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define ull unsigned long long
#define elif else if
#define pb push_back
#define add insert
#define fastio cout.tie(nullptr);cin.tie(nullptr);ios_base::sync_with_stdio(false)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define len(x) (ll)((x).size())
#define gcd __gcd
#define lcm(a,b) (a)/gcd((a),(b))*(b)
#define precision(x) cout<<setprecision((x))
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef pair<ll,ll>pll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update>ordered_multiset;
typedef vector<vector<ll>>graph;

template<typename A,typename B>void umin(A&a,B b){if(a>b)a=b;}
template<typename A,typename B>void umax(A&a,B b){if(a<b)a=b;}
template<typename B,typename E,typename M>M binpow(B b,E e,M m){M r=1;while(e>0){if(e&1)r=r*b%m;b=b*b%m;e>>=1;}return r;}
string to_string(string&s){return "\""+s+"\"";}
template<typename A,typename B>string to_string(pair<A,B>v){return "{"+to_string(v.first)+" "+to_string(v.second)+"}";}
template<typename T>string to_string(set<T>v){string r="{",e;for(auto i:v)r+=e+to_string(i),e=", ";return r+"}";}
template<typename T>string to_string(vector<T>v){string r="{",e;for(auto i:v)r+=e+to_string(i),e=", ";return r+"}";}
void debug(){cerr<<endl;}template<typename Head,typename...Tail>void debug(Head H,Tail...T){cerr<<" "<<to_string(H);debug(T...);}
#ifdef LOCAL
#define debug(...)cerr<<"["<<#__VA_ARGS__<<"]:",debug(__VA_ARGS__)
#else
#define debug(...)
#endif

//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma,sse4")
//#pragma comment(linker,"/STACK:128777216")

const ld pi  = 3.14159265358979323846264338327950288419716939937510;
const ld eps = 1e-8;
const ll inf = 1e12;
const ll MOD = 998244353;
const ll maxN= 2e5+9;
ll t[maxN*3];
ll pw[maxN];
ll n;
ll lazy[maxN*3];
ll prec[10][maxN];
void build(ll v,ll tl,ll tr){
	if(tl==tr){
		t[v]=1;
	}
	else{
		ll tm=(tl+tr)/2;
		build(v*2,tl,tm);
		build(v*2+1,tm+1,tr);
		t[v]=(t[v*2]*pw[tr-(tm+1)+1]%MOD+t[v*2+1])%MOD;
	}
}
void push(ll v,ll tl,ll tr){
	if(lazy[v]){
		ll tm=(tl+tr)/2;
		lazy[v*2]=lazy[v*2+1]=lazy[v];
		t[v*2]=prec[lazy[v]][tm-tl+1];
		t[v*2+1]=prec[lazy[v]][tr-(tm+1)+1];
		lazy[v]=0;
	}
}
void update(ll v,ll tl,ll tr,ll l,ll r,ll what){
	if(l>r)return;
	if(tl==l && tr==r){
		lazy[v]=what;
		t[v]=prec[what][r-l+1];
		return;
	}
	ll tm=(tl+tr)/2;
	push(v,tl,tr);
	update(v*2,tl,tm,l,min(tm,r),what);
	update(v*2+1,tm+1,tr,max(l,tm+1),r,what);
	t[v]=(t[v*2]*pw[tr-(tm+1)+1]%MOD+t[v*2+1])%MOD;
}
ll sum(ll v,ll tl,ll tr,ll l,ll r){
	if(l>r)return 0;
	if(tl==l & tr==r){
		return t[v];
	}
	push(v,tl,tr);
	ll tm=(tl+tr)/2;
	return (sum(v*2,tl,tm,l,min(tm,r))+
		   sum(v*2+1,tm+1,tr,max(tm+1,l),r))%MOD;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	fastio;
	pw[0]=1;
	for(ll i=1;i<maxN;i++){
		pw[i]=pw[i-1]*10%MOD;
	}
	for(ll i=1;i<=9;i++){
		for(ll j=1;j<maxN;j++){
			prec[i][j]=(prec[i][j-1]*10+i)%MOD;
		}
	}
	ll q,l,r,d;
	cin>>n>>q;
	build(1,0,n-1);
	//cout<<t[1]<<'\n';
	while(q--){
		cin>>l>>r>>d;l--;r--;
		update(1,0,n-1,l,r,d);
		cout<<t[1]<<'\n';
	}
}

Measured memory_bytes: 27492