#include"bits/stdc++.h"
using namespace std; 
#define pb push_back
#define eb emplace_back
#define ins insert
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define lb lower_bound
#define ub upper_bound
#ifndef ONLINE_JUDGE
#define _getchar_nolock getchar_unlocked
#define pc putchar_unlocked
#else 
#define pc _putchar_nolock
#endif
#define F1 Flusher(); pc(' ');
#define F2 Flusher(); pc('\n');
#define sz(x) (int)x.size()
#define pii pair<int,int>
#define fir first
#define sec second
#define popcount __builtin_popcount 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using ll=long long int;
using ld=long double;
#define mp make_pair
#define mt make_tuple
#define bit(x,j) (((ll)x>>j)&1)
#define um unordered_map 
#define mem(a,val) memset(a,val,sizeof(a))
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(ld 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...);}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) 
{ return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) 
{ return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")"; } 
void debug_out() { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) 
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifndef ONLINE_JUDGE 
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#ifndef ONLINE_JUDGE 
#define debugt(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debugt(...) 42
#endif
constexpr int N=2*100000;  
constexpr int mod2=998244353; 
ll powerm2(ll a,ll b){ ll res=1; while(b) { if(b&1) res=(res*a)%mod2; a=(a*a)%mod2; b>>=1; } return res; }
int n,q; ll st[4*(N+2)]; int lazy[4*(N+2)]; ll c[10][200002];  
void build(int ss,int se,int si)
{
  if(ss==se){ st[si]=1; return; }
  int mid=(ss+se)>>1; 
  build(ss,mid,2*si+1); build(mid+1,se,2*si+2); 
  ll ans=powerm2(10,(se-(mid+1)+1)); ans=(ans*st[2*si+1])%mod2; 
  ans=(ans+st[2*si+2])%mod2; st[si]=ans;  
} 
void update(int ss,int se,int si,int l,int r,int val)
{
  if(lazy[si]!=-1)
  {
    int digit=lazy[si]; int len=(se-ss+1); 
    st[si]=c[digit][len]; 
    if(ss!=se)
    {
      lazy[2*si+1]=digit; 
      lazy[2*si+2]=digit; 
    }
    lazy[si]=-1;  
  }
  if(ss>se||ss>r||se<l) return; 
  if(ss>=l and se<=r)
  {
    int digit=val; int len=(se-ss+1); 
    st[si]=c[digit][len];
    if(ss!=se)
    {
      lazy[2*si+1]=digit; 
      lazy[2*si+2]=digit; 
    }
    return; 
  }
  int mid=(ss+se)>>1; 
  update(ss,mid,2*si+1,l,r,val); update(mid+1,se,2*si+2,l,r,val); 
  ll ans=powerm2(10,(se-(mid+1)+1)); ans=(ans*st[2*si+1])%mod2; 
  ans=(ans+st[2*si+2])%mod2; st[si]=ans;  
}
ll query(int ss,int se,int si,int l,int r)
{
  if(lazy[si]!=-1)
  {
    int digit=lazy[si]; int len=(se-ss+1); 
    st[si]=c[digit][len]; 
    if(ss!=se)
    {
      lazy[2*si+1]=digit; 
      lazy[2*si+2]=digit; 
    }
    lazy[si]=-1;  
  }
  if(ss>se||ss>r||se<l) return 0; 
  if(ss>=l and se<=r) return st[si]; 
  int mid=(ss+se)>>1; 
  ll ans=query(ss,mid,2*si+1,l,r); ans%=mod2; 
  ans=(ans*powerm2(10,se-(mid+1)+1))%mod2; ans=(ans+query(mid+1,se,2*si+2,l,r))%mod2;
  return ans;  
}
void solve()
{
 rep(i,0,9)
 {
  ll res=0; 
  rep(j,0,200000)
  {
    c[i][j]=res; res=(res*10+i)%mod2;  
  }
 } 
 cin>>n>>q; build(0,n-1,0); int l,r,d;
 ll k=query(0,n-1,0,0,n-1);   
 while(q--)
 {
  cin>>l>>r>>d; l--; r--;  
  update(0,n-1,0,l,r,d); cout<<query(0,n-1,0,0,n-1)<<"\n"; 
 }
 return; 
}
int main()
{
   #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  mem(lazy,-1); 
  ios_base::sync_with_stdio(false); cin.tie(0); 
  solve(); 
}

Measured memory_bytes: 26452