//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include "bits/stdc++.h"

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

template<const int &MOD>
struct _m_int {
    int val;
 
    _m_int(int64_t v = 0) {
        if (v < 0) v = v % MOD + MOD;
        if (v >= MOD) v %= MOD;
        val = int(v);
    }
 
    _m_int(uint64_t v) {
        if (v >= MOD) v %= MOD;
        val = int(v);
    }
 
    _m_int(int v) : _m_int(int64_t(v)) {}
    _m_int(unsigned v) : _m_int(uint64_t(v)) {}
 
    static int inv_mod(int a, int m = MOD) {
        // https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Example
        int g = m, r = a, x = 0, y = 1;
 
        while (r != 0) {
            int q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }
 
        return x < 0 ? x + m : x;
    }
 
    explicit operator int() const { return val; }
    explicit operator unsigned() const { return val; }
    explicit operator int64_t() const { return val; }
    explicit operator uint64_t() const { return val; }
    explicit operator double() const { return val; }
    explicit operator long double() const { return val; }
 
    _m_int& operator+=(const _m_int &other) {
        val -= MOD - other.val;
        if (val < 0) val += MOD;
        return *this;
    }
 
    _m_int& operator-=(const _m_int &other) {
        val -= other.val;
        if (val < 0) val += MOD;
        return *this;
    }
 
    static unsigned fast_mod(uint64_t x, unsigned m = MOD) {
#if !defined(_WIN32) || defined(_WIN64)
        return unsigned(x % m);
#endif
        // Optimized mod for Codeforces 32-bit machines.
        // x must be less than 2^32 * m for this to work, so that x / m fits in an unsigned 32-bit int.
        unsigned x_high = unsigned(x >> 32), x_low = unsigned(x);
        unsigned quot, rem;
        asm("divl %4\n"
            : "=a" (quot), "=d" (rem)
            : "d" (x_high), "a" (x_low), "r" (m));
        return rem;
    }
 
    _m_int& operator*=(const _m_int &other) {
        val = fast_mod(uint64_t(val) * other.val);
        return *this;
    }
 
    _m_int& operator/=(const _m_int &other) {
        return *this *= other.inv();
    }
 
    friend _m_int operator+(const _m_int &a, const _m_int &b) { return _m_int(a) += b; }
    friend _m_int operator-(const _m_int &a, const _m_int &b) { return _m_int(a) -= b; }
    friend _m_int operator*(const _m_int &a, const _m_int &b) { return _m_int(a) *= b; }
    friend _m_int operator/(const _m_int &a, const _m_int &b) { return _m_int(a) /= b; }
 
    _m_int& operator++() {
        val = val == MOD - 1 ? 0 : val + 1;
        return *this;
    }
 
    _m_int& operator--() {
        val = val == 0 ? MOD - 1 : val - 1;
        return *this;
    }
 
    _m_int operator++(int) { _m_int before = *this; ++*this; return before; }
    _m_int operator--(int) { _m_int before = *this; --*this; return before; }
 
    _m_int operator-() const {
        return val == 0 ? 0 : MOD - val;
    }
 
    friend bool operator==(const _m_int &a, const _m_int &b) { return a.val == b.val; }
    friend bool operator!=(const _m_int &a, const _m_int &b) { return a.val != b.val; }
    friend bool operator<(const _m_int &a, const _m_int &b) { return a.val < b.val; }
    friend bool operator>(const _m_int &a, const _m_int &b) { return a.val > b.val; }
    friend bool operator<=(const _m_int &a, const _m_int &b) { return a.val <= b.val; }
    friend bool operator>=(const _m_int &a, const _m_int &b) { return a.val >= b.val; }
 
    _m_int inv() const {
        return inv_mod(val);
    }
 
    _m_int pow(int64_t p) const {
        if (p < 0)
            return inv().pow(-p);
 
        _m_int a = *this, result = 1;
 
        while (p > 0) {
            if (p & 1)
                result *= a;
 
            p >>= 1;
 
            if (p > 0)
                a *= a;
        }
 
        return result;
    }
 
    friend ostream& operator<<(ostream &os, const _m_int &m) {
        return os << m.val;
    }
};

const int MOD = 998244353;
using mod_int = _m_int<MOD>;

mod_int inv9 = mod_int(1)/9;

struct S {
  mod_int x;
  mod_int w;

  // This should be the identity element
  S()
  {
    x = 0;
    w = 1;
  }
  
  S(mod_int _x, mod_int _w):x(_x), w(_w){}
};

// Paremeters of the function we are applying on the range.
struct F{
  int d;
  // Must be identity
  F() {d=0;}
  F(int _d):d(_d){}
};

// Returns the transform with parameters F and input S
S mapping(F f, S x)
{
  if (f.d==0)
    return x;
  return S((x.w-1)*inv9*f.d,x.w);
}

// Returns f o g, which is the composition of them under the operation op
// It is necessary that f(x) o f(y) = f(x o y)
F composition(F f, F g)
{
  if (f.d==0) return g;
  return f;
}

S op(S a, S b)
{
  return S(a.x*b.w+b.x,a.w*b.w);
}

// Predicate for binary search. Must be true for identity.
bool f(S /*x*/)
{
  // Dummy for binary search
  return true;
}

struct lazy_segtree
{
  int _n;
  vector<S> t;
  vector<F> lz;
  int size;
  int log;

  lazy_segtree(): lazy_segtree(0) {}

  lazy_segtree(int n = -1)
  {
    if (n >= 0)
      init(n);
  }

  lazy_segtree(vector<S> v)
  {
    build(v);
  }

  void init(int n)
  {
    _n = n;
    log = 0;
    while ((1U<<log) < (unsigned int)(n)) log++;
    size = 1<<log;
    t.assign(2*size,S());
    lz = vector<F>(size);
  }

  void build(vector<S> v)
  {
    init((int)v.size());
    assert(_n != 0);

    for (int i = 0; i < _n; i++)
      t[size+i] = v[i];

    for (int i = size-1; i > 0; i--)
      t[i] = op(t[2*i],t[2*i+1]);
  }

  void all_apply(int k, F f)
  {
    t[k] = mapping(f,t[k]);
    if (k < size) lz[k] = composition(f,lz[k]);
  }

  void push(int k)
  {
    all_apply(2*k,lz[k]);
    all_apply(2*k+1,lz[k]);
    lz[k] = F();
  }

  void set(int p, S x)
  {
    assert(0 <= p && p < _n);
    p += size;
    for (int i = log; i >= 1; i--)
      push(p>>i);
    t[p] = x;
    for (int i = 1; i <= log; i++)
      t[p>>i] = op(t[2*(p>>i)],t[2*(p>>i)+1]);
  }

  S get(int p)
  {
    assert(0 <= p && p < _n);
    p += size;
    for (int i = log; i >= 1; i--)
      push(p>>i);
    return t[p];
  }

  // Find result for range [l,r)
  S query (int l, int r)
  {
    assert(0 <= l && l <= r && r <= _n);
    if (l==r) return S();
    S ansl, ansr;
    l += size;
    r += size;

    for (int i = log; i >= 1; i--)
    {
      if (((l>>i)<<i) != l) push (l>>i);
      if (((r>>i)<<i) != r) push (r>>i);
    }

    while (l < r)
    {
      if (l&1) ansl = op(ansl,t[l++]);
      if (r&1) ansr = op(t[--r],ansr);
      l >>= 1;
      r >>= 1;
    }
    return op(ansl,ansr);
  }

  void apply(int p, F f)
  {
    assert(0 <= p && p < _n);
    p += size;
    for (int i = log; i >= 1; i--)
      push(p>>i);
    t[p] = mapping(f,t[p]);
    for (int i = 1; i <= log; i++)
      t[p>>i] = op(t[2*(p>>i)],t[2*(p>>i)+1]);
  }

  void apply(int l, int r, F f)
  {
    assert(0 <= l && l <= r && r <= _n);
    if (l==r) return;

    l += size;
    r += size;

    for (int i = log; i >= 1; i--)
    {
      if (((l >> i)<<i)!=l) push(l>>i);
      if (((r >> i)<<i)!=r) push((r-1)>>i);
    }

    {
      int l2 = l, r2 = r;
      while (l < r)
      {
        if (l&1) all_apply(l++,f);
        if (r&1) all_apply(--r,f);
        l >>= 1;
        r >>= 1;
      }
      l = l2, r = r2;
    }

    for (int i = 1; i <= log; i++)
    {
      if (((l >> i)<<i)!=l) t[l>>i] = op(t[2*(l>>i)],t[2*(l>>i)+1]);
      if (((r >> i)<<i)!=r) t[(r-1)>>i] = op(t[2*((r-1)>>i)],t[2*((r-1)>>i)+1]);
    }
  }

  /* Binary Search */
  // Find the maximum value of r such that [l,r) is true
  int max_right(int l)
  {
    assert(0 <= l && l <= _n);

    if (l==_n) return _n;
    l += size;
    for (int i = log; i >= 1; i--)
      push(l>>i);
    S sm;
    do{
      while (l%2==0)
        l >>= 1;
      if (!f(op(sm,t[l])))
      {
        while (l < size) {
          push(l);
          l *= 2;
          if (f(op(sm,t[l])))
          {
            sm = op(sm,t[l]);
            l++;
          }
        }
        return l - size;
      }
      sm = op(sm,t[l]);
      l++;
    } while((l&-l) != l);
    return _n;
  }

  // This is the minimum l such that [l,r) is true
  int min_left(int r)
  {
    assert(0 <= r && r <= _n);
    if (r==0)
      return 0;
    r += size;
    for (int i = log; i >= 1; i--)
      push((r-1)<<i);
    S sm;
    do {
      r--;
      while(r>1 && (r%2)) r >>= 1;
      if (!f(op(t[r],sm)))
      {
        while (r < size)
        {
          push(r);
          r = (2*r+1);
          if (f(op(t[r],sm)))
          {
            sm = op(t[r],sm);
            r--;
          }
        }
        return r+1-size;
      }
      sm = op(t[r],sm);
    }
    while((r & -r) != r);
    return 0;
  }
};

void solve()
{
  int n,q;
  cin >> n >> q;
  lazy_segtree T(n);
  for (int i = 0; i < n; i++)
    T.set(i,S(1,10));
  while(q--)
  {
    int l,r,d;
    cin >> l >> r >> d;
    l--;
    T.apply(l,r,{d});
    S ans = T.query(0,n);
    cout << ans.x << endl;
  }
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  ll t = 1;
  //cin >> t;
  while (t--)
  {
    solve();
  }
}



Measured memory_bytes: 8444