#include <bits/stdc++.h>

#include <atcoder/all>

using namespace std;

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (998244353ll)

const long long INF = 1LL << 60;

// #define mod (ll)(1e9 + 7)

#define USE_MODINT

template <ll ModVal>
struct ModInt {
  ll x;

  ModInt(ll _x = 0) : x((_x % ModVal + ModVal) % ModVal) {
  }

  ModInt operator-() const {
    return ModInt(-x);
  }
  ModInt& operator+=(const ModInt a) {
    x += a.x;
    if (x >= ModVal)
      x -= ModVal;
    return *this;
  }
  ModInt& operator-=(const ModInt a) {
    x = x + ModVal - a.x;
    if (x >= ModVal)
      x -= ModVal;
    return *this;
  }
  ModInt& operator*=(const ModInt a) {
    x *= a.x;
    x %= ModVal;
    return *this;
  }

  // 返り値: gcd(a, b)
  // ax + by = gcd(a, b) を満たす (x, y)
  ll ext_gcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
      x = 1;
      y = 0;
      return a;
    }
    ll tmp = a / b;
    ll d = ext_gcd(b, a - b * tmp, y, x);
    y -= tmp * x;
    return d;
  }

  // 逆元
  ModInt inv() {
    ll u, v;
    ext_gcd(x, ModVal, u, v);
    return ModInt(u);
  }

  ModInt inv(const ModInt a) {
    ll u, v;
    ext_gcd(a.x, ModVal, u, v);
    return ModInt(u);
  }

  ModInt& operator/=(const ModInt a) {
    return (*this) *= inv(a);
  }

  ModInt operator+(const ModInt a) const {
    ModInt retval(*this);
    return retval += a;
  }
  ModInt operator-(const ModInt a) const {
    ModInt retval(*this);
    return retval -= a;
  }
  ModInt operator*(const ModInt a) const {
    ModInt retval(*this);
    return retval *= a;
  }
  ModInt operator/(const ModInt a) const {
    ModInt retval(*this);
    return retval /= a;
  }

  ModInt pow(ll n) {
    ModInt ans(1);
    while (n) {
      if (n & 1)
        ans = ans * x;
      *this = (*this) * (*this);
      n = n >> 1;
    }
    return ans;
  }

  constexpr const ll& value() {
    return this->x;
  }
};

template <ll ModVal>
ostream& operator<<(ostream& os, const ModInt<ModVal>& a) {
  os << a.x;
  return os;
}

using mint = ModInt<mod>;

template <typename T>
class Combination {
 public:
  Combination(ll _max_n) : max_n(_max_n), factional(max_n + 1), inv(max_n + 1) {
    factional[0] = 1;
    inv[0] = 1;
    for (ll i = 0; i < max_n; i++) {
      factional[i + 1] = factional[i] * (i + 1); // n!(mod M)
      inv[i + 1] = inv[i] / (i + 1);             // k!^(M-2) (mod M)
    }
  }

  // nCk
  T choose(ll n, ll k) {
    if (n == 0 && k == 0)
      return 1;
    if (n < k || n < 0)
      return 0;
    T tmp = inv[n - k] * inv[k];
    return tmp * factional[n];
  }

  T permutation(ll n, ll k) {
    if (n - k < 0) {
      return 0;
    }
    return factional[n] / factional[n - k];
  }

 private:
  const ll max_n;
  std::vector<T> factional;
  std::vector<T> inv;
};

using Comb = Combination<mint>;

using vm = vector<mint>;
using vvm = vector<vm>;
using vvvm = vector<vvm>;

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

vector<mint> ten;
vector<mint> ones;

struct S {
  mint value;
  int size;
};

using F = int;

// 結合の仕方
S op(S a, S b) {
  return {(a.value * ten[b.size] + b.value), a.size + b.size};
}

// 単位元
S e() {
  return {0, 0};
}

// 更新の仕方
S mapping(F f, S x) {
  if (f == 0)
    return x;
  x.value = ones[x.size] * f;
  return x;
}

// 伝搬のさせ方
F composition(F l, F r) {
  return ((l == 0) ? r : l);
}

// 伝搬のところの初期値
F id() {
  return 0;
}

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

  ten = vector<mint>(n + 10);
  ten[0] = 1;
  for (int i = 1; i < n + 10; i++) {
    ten[i] = ten[i - 1] * mint(10);
  }

  ones = vector<mint>(n + 10);
  ones[0] = 0;
  for (int i = 1; i < n + 10; i++) {
    ones[i] = ones[i - 1] * mint(10) + 1;
  }

#if 0
  atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
  for (int i = 0; i < n; i++) {
    seg.set(i, {
                 1,
                 1,
               });
  }
#else
  atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(vector<S>(n, S{1, 1}));
#endif

  for (int i = 0; i < q; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    l--;
    seg.apply(l, r, F{d});
    cout << seg.prod(0, n).value << "\n";
  }
}


Measured memory_bytes: 18796