#include<iostream>
#include<vector>

namespace ate{
  template<int64_t p>struct F_p{
    using value_type = int64_t;
    static constexpr inline value_type get_mod(){return p;}
    value_type value;constexpr F_p():value(value_type{}){}
    template<class T>constexpr F_p(T v):value(static_cast<value_type>(v<0?v%p+p:v%p)){}
    constexpr F_p  operator +  (const F_p& other)const{return F_p(*this) += other;}
    constexpr F_p  operator -  (const F_p& other)const{return F_p(*this) -= other;}
    constexpr F_p  operator *  (const F_p& other)const{return F_p(*this) *= other;}
    constexpr F_p  operator /  (const F_p& other)const{return F_p(*this) /= other;}
    constexpr F_p &operator += (const F_p& other){value+=other.value;if(value>p)value-=p;return *this;}
    constexpr F_p &operator -= (const F_p& other){value-=other.value;if(value<0)value+=p;return *this;}
    constexpr F_p &operator *= (const F_p& other){value*=other.value;if(value>p)value%=p;return *this;}
    constexpr F_p &operator /= (const F_p& other){value*=other.inverse();if(value>p)value%=p;return *this;}
    static constexpr value_type ext_gcd(value_type a,value_type b,value_type& x,value_type& y){if(b==0){x=1,y=0;return a;}value_type d=ext_gcd(b,a%b,y,x);y-=a/b*x;return d;}
    constexpr value_type inverse()const{value_type x,y;ext_gcd(value,p,x,y);return x<0?x%p+p:x%p;}
    template<class T>static constexpr value_type inverse(T val){value_type x,y;ext_gcd(val,p,x,y);return x<0?x%p+p:x%p;}
    template<class T>constexpr F_p mpow(T n)const{F_p res(1),vn(*this);while(n){if(n&1)res*=vn;vn*=vn;n>>=1;}return res;}
    template<class T,class U>static constexpr T mpow(T a,U b){F_p x(a);return static_cast<T>(x.mpow(b).value);}
    constexpr friend std::istream &operator >> (std::istream& is,F_p& fp){return is>>fp.value;}
    constexpr friend std::ostream &operator << (std::ostream& os,const F_p& fp){return os<<fp.value;}
    constexpr bool operator == (const F_p& other)const{return value == other.value;}
  };
}
using mint = ate::F_p<998244353>;

template<class T,class U,class F,class G,class H>
struct lazy_segment_tree{
  std::vector<T> data;
  std::vector<U> lazy;
  int n,height;
  F merge;
  G mapping;
  H composition;
  T ti;
  U ui;
  lazy_segment_tree(){}
  lazy_segment_tree(std::vector<T>const& v,T ide1,U ide2,F f,G g,H h)
    :ti(ide1),ui(ide2),merge(f),mapping(g),composition(h)
  {
    int sz = std::size(v);
    n=1,height=0;
    while(n<sz)n<<=1,height++;
    data.resize(n<<1,ti);
    lazy.resize(n<<1,ui);
    for(int i=0;i<sz;++i)
      data[i+n] = v[i];
    for(int i=n;i-->0;)
      data[i] = merge(data[i<<1|0],data[i<<1|1]);
  }
  inline T reflect(int k){
    return lazy[k]==ui?data[k]:mapping(data[k],lazy[k]);
  }
  inline void evaluate(int k){
    if(lazy[k]==ui)return;
    if(k<n){
      lazy[k<<1|0] = composition(lazy[k<<1|0],lazy[k]);
      lazy[k<<1|1] = composition(lazy[k<<1|1],lazy[k]);
    }
    data[k] = reflect(k);
    lazy[k] = ui;
  }
  inline void propagate(int k){
    for(int i=height;i>=0;--i)evaluate(k>>i);
  }
  inline void recalc(int k){
    while(k>>=1)data[k] = merge(reflect(k<<1|0),reflect(k<<1|1));
  }
  void update(int a,int b,U v){
    a+=n;b+=n;propagate(a);propagate(b-1);
    for(int l=a,r=b;l<r;l>>=1,r>>=1){
      if(l&1)lazy[l] = composition(lazy[l],v),l++;
      if(r&1)--r,lazy[r] = composition(lazy[r],v);
    }
    recalc(a);recalc(b-1);
  }
  T fold(int a,int b){
    a+=n;b+=n;propagate(a),propagate(b-1);
    T lef_v(ti),rig_v(ti);
    for(int l=a,r=b;l<r;l>>=1,r>>=1){
      if(l&1)lef_v = merge(lef_v,reflect(l)),l++;
      if(r&1)--r,rig_v = merge(reflect(r),rig_v);
    }
    return merge(lef_v,rig_v);
  }
  T fold(){return data[1];}
  T fold_all(){return data[1];}
  T operator[](int k){k+=n;propagate(k);return data[k];}
};
template<class T,class U,class F,class G,class H>
auto make_lseg(std::vector<T> v,T ide1,U ide2,F f,G g,H h){
  return lazy_segment_tree<T,U,F,G,H>(v,ide1,ide2,f,g,h);
}

int main(){
  using namespace std;
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  constexpr char newl = '\n';
  
  int n,q;
  cin>>n>>q;

  vector<mint> tenpow(n+1,1);
  for(int i=0;i<n;++i)tenpow[i+1]=tenpow[i]*10;

  vector<vector<mint>> ushi(10,vector<mint>(n+1));
  // ushi[i][j] := iii...iii, len(iii...iii)==j
  // ex. ushi[3][8] == 33333333
  for(int i=1;i<10;++i)
    for(int j=0;j<n;++j)
      ushi[i][j+1] = ushi[i][j]*10+i;

  struct tapu{
    mint val;
    int sz;
    tapu():val(),sz(){}
    tapu(mint v,int s):val(v),sz(s){}
    operator mint(){return val;}
  };
  auto merge = [&tenpow](tapu a,tapu b){
    // ex. merge(1133,3366)
    //      return 112233 * 10000 + 3366
    //              10000 = pow(10,len(3366))
    mint v = a.val * tenpow[b.sz] + b.val;
    return tapu(v,a.sz+b.sz);
  };
  auto mapping = [&ushi](tapu a,int b){
    // ex. mapping({1122,4},3)
    //      return {3333,4}
    return tapu(ushi[b][a.sz],a.sz);
  };
  auto composition = [](int a,int b){
    return b;
  };
  vector<tapu> first_state(n,{1,1});
  tapu tp_identity = {0,0};
  int updt_identity = -1;
  auto seg = make_lseg(first_state,tp_identity,updt_identity,merge,mapping,composition);

  for(int i=0;i<q;++i){
    int l,r,d;
    cin>>l>>r>>d;
    l--;r--;
    seg.update(l,r+1,d);
    mint ans = seg.fold();
    cout<<ans<<newl;
  }

}

Measured memory_bytes: 36940