#include <bits/stdc++.h>
#ifdef _DEBUG
#include "_DEBUG.hpp"
#endif
#define int long long
using namespace std;
using P = pair<int, int>;
const int inf = 2e18;
const int mod = 1e9 + 7;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}

template <class T>
vector<T> make_vec(size_t a) {
  return vector<T>(a);
}

template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template <class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
  t = v;
}

template <class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
  for (auto &e : t) fill(e, v);
}

template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
};
using mint = ModInt<998244353>;

/* SegTreeLazyProportional<X,M>(n,fx,fa,fm,fp,ex,em): モノイド(集合X,
   二項演算fx,fa,fm,p 単位元ex,em)についてサイズnで構築 set(int i, X x),
   build(): i番目の要素をxにセット。まとめてセグ木を構築する。O(n) update(i,x):
   i 番目の要素を x に更新。O(log(n)) query(a,b):  [a,b)
   全てにfxを作用させた値を取得。O(log(n))
*/
template <typename X, typename M>
struct SegTreeLazyProportional {
  using FX = function<X(X, X)>;
  using FA = function<X(X, M)>;
  using FM = function<M(M, M)>;
  using FP = function<M(M, int)>;
  int n;
  FX fx;
  FA fa;
  FM fm;
  FP fp;
  const X ex;
  const M em;
  vector<X> dat;
  vector<M> lazy;
  SegTreeLazyProportional(int n_, FX fx_, FA fa_, FM fm_, FP fp_, X ex_, M em_)
      : n(),
        fx(fx_),
        fa(fa_),
        fm(fm_),
        fp(fp_),
        ex(ex_),
        em(em_),
        dat(n_ * 4, ex),
        lazy(n_ * 4, em) {
    int x = 1;
    while (n_ > x) x *= 2;
    n = x;
  }

  void set(int i, X x) { dat[i + n - 1] = x; }
  void build() {
    for (int k = n - 2; k >= 0; k--)
      dat[k] = fx(dat[2 * k + 1], dat[2 * k + 2]);
  }

  /* lazy eval */
  void eval(int k, int len) {
    if (lazy[k] == em) return;  // 更新するものが無ければ終了
    if (k < n - 1) {            // 葉でなければ子に伝搬
      lazy[k * 2 + 1] = fm(lazy[k * 2 + 1], lazy[k]);
      lazy[k * 2 + 2] = fm(lazy[k * 2 + 2], lazy[k]);
    }
    // 自身を更新
    dat[k] = fa(dat[k], fp(lazy[k], len));
    lazy[k] = em;
  }

  void update(int a, int b, M x, int k, int l, int r) {
    eval(k, r - l);
    if (a <= l && r <= b) {  // 完全に内側の時
      lazy[k] = fm(lazy[k], x);
      eval(k, r - l);
    } else if (a < r && l < b) {                   // 一部区間が被る時
      update(a, b, x, k * 2 + 1, l, (l + r) / 2);  // 左の子
      update(a, b, x, k * 2 + 2, (l + r) / 2, r);  // 右の子
      dat[k] = fx(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  void update(int a, int b, M x) { update(a, b, x, 0, 0, n); }

  X query_sub(int a, int b, int k, int l, int r) {
    eval(k, r - l);
    if (r <= a || b <= l) {  // 完全に外側の時
      return ex;
    } else if (a <= l && r <= b) {  // 完全に内側の時
      return dat[k];
    } else {  // 一部区間が被る時
      X vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
      X vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
      return fx(vl, vr);
    }
  }
  X query(int a, int b) { return query_sub(a, b, 0, 0, n); }
};

signed main() {
  int n, q;
  cin >> n >> q;

  using X = pair<mint, mint>;
  using M = mint;
  auto fx = [](X x1, X x2) -> X { return {x1.first + x2.first, x1.second + x2.second}; };
  auto fa = [](X x, M m) -> X { return {m * x.second, x.second}; };
  auto fm = [](M m1, M m2) -> M { return m2; };
  auto fp = [](M m, int n) -> M { return m; };
  X ex = {0, 0};
  M em = inf;
  SegTreeLazyProportional<X, M> seg(n, fx, fa, fm, fp, ex, em);
  vector<mint> v(n);
  v[0] = 1;
  for (int i = 1; i < n; i++) {
    v[i] = v[i-1] * 10;
  }
  reverse(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    seg.set(i, {v[i], v[i]});
  }
  seg.build();

  for (int i = 0; i < q; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    seg.update(l - 1, r, d);
    cout << seg.query(0, n).first << endl;
  }

  return 0;
}

Measured memory_bytes: 23560