#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (ll i=(ll)N-1; i>=0; i--)

const ll MOD = 998244353;
const ll LLINF = pow(2,61)-1;
const ll INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(ll x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { ll d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll modpow(ll x, ll p) { ll result = 1, now = 1, pm = x; while (now<=p) { if (p&now) { result = result * pm % MOD; } now*=2; pm = pm*pm % MOD; } return result; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct value {
  ll dig, num;
  value operator+ (const value &x) const {
    return {dig*x.dig%MOD, (num*x.dig+x.num)%MOD};
  };
};

struct LazySegTree {
  ll size, dig;
  vector<ll> op_mul, op_id;
  LazySegTree(ll N) {
    size = 1; dig = 1; while(size<N) { size<<=1; dig++; }
    op_mul.resize(dig); rep(i,dig) op_mul[i] = i==0 ? 1 : (modpow(10,modpow(2,i-1))+1)*op_mul[i-1]%MOD;
    op_id.resize(2*size); rep(i,dig) repr(j,modpow(2,i),modpow(2,i+1)) { op_id[j] = (dig-1) - i; }
    val.resize(2*size,val_e); ope.resize(2*size,ope_e);
    for (ll i=size-1; i>=1; i--) val[i] = f(h(i*2), h(i*2+1));
  }
  value operator[](ll x) { return query(x,x+1); }

  void propagation(ll x, ll y) {
    vector<ll> order;
    for (x+=size, y+=size-1; x&&y; x>>=1, y>>=1) {
      order.push_back(x);
      if (x!=y) order.push_back(y);
    }
    for (auto itr=rbegin(order); itr!=rend(order); ++itr) {
      if (*itr>=size) break;
      ope[*itr*2]   = g(ope[*itr*2]  , ope[*itr]);
      ope[*itr*2+1] = g(ope[*itr*2+1], ope[*itr]);
      ope[*itr]     = ope_e;
    }
  }

  void update_operator(ll x, ll y, ll v) {
    for (x+=size, y+=size; x<y; x>>=1, y>>=1) {
      if (x&1) { ope[x] = g(ope[x],v); x++; }
      if (y&1) { y--; ope[y] = g(ope[y],v); }
    }
  }

  void back_propagation(ll x, ll y) {
    for (x+=size, y+=size-1; x&&y; x>>=1, y>>=1) {
      if (x<size) val[x] = f(h(x*2), h(x*2+1));
      if (y<size) val[y] = f(h(y*2), h(y*2+1));
    }
  }

  void set_operator(ll x, ll y, ll v) {
    propagation(x,y);
    update_operator(x,y,v);
    back_propagation(x,y);
  }

  void set_value(ll x, value v) {
    propagation(x,x+1);
    val[x+size] = v;
    ope[x+size] = ope_e;
    back_propagation(x,x+1);
  }

  value query(ll x, ll y) {
    propagation(x,y);
    back_propagation(x,y);
    value L = val_e, R = val_e;
    ll np = 0;
    for (x+=size, y+=size; x<y; x>>=1, y>>=1) {
      if (x&1) { L = f(L,h(x)); x++; }
      if (y&1) { y--; R = f(h(y),R); }
      np++;
    }
    return f(L,R);
  }

  // ---------------------------------------------
  // 触るところ
  // ---------------------------------------------
  vector<value> val; value val_e = {1,0};
  vector<ll> ope; ll ope_e = 0;

  void operate(ll i) { val[i] = f(val[i*2], val[i*2+1]); }
  value f(value x, value y) { return x + y; } // 要素同士の演算
  ll g(ll x, ll y) { return y ? y : x; } // 作用素同士の演算
  value h(ll x) { return ope[x] ? (value){val[x].dig, ope[x]*op_mul[op_id[x]]%MOD} : val[x]; } // 要素に作用素を書ける

  void output() {
    rep(i,size*2) cout << i << ":" << val[i].dig << "-" << val[i].num << " " << ope[i] << endl;
    debug(all(op_id)); debug(all(op_mul));
    // rep(i,size) cout << query(i,i+1).num << " "; cout << endl; 
  }
};

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

int main() {
  ll N, Q; cin >> N >> Q;

  LazySegTree lst(N); rep(i,N) lst.set_value(i,{10,1});
  rep(_,Q) {
    ll L, R, D; cin >> L >> R >> D; L--;
    lst.set_operator(L,R,D);
    // lst.output();
    cout << lst.query(0,N).num << endl;
  }
  // cout << result << endl;
  return 0;
}

Measured memory_bytes: 19636