#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#include <atcoder/all>
using namespace atcoder;
using namespace std;

void debug_out(){ cout << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 998244353;
const ll INF = (1<<30)-1;
const ll INFLL = 1ll<<60;
const double PI = acos(-1);

struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

struct mint {
  int val;
  constexpr mint(int v = 0) noexcept : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  constexpr int getMOD() { return MOD; }
  constexpr mint operator - () const noexcept {
    return val ? MOD - val : 0;
  }
  constexpr mint operator + (const mint& r) const noexcept { return mint(*this) += r; }
  constexpr mint operator - (const mint& r) const noexcept { return mint(*this) -= r; }
  constexpr mint operator * (const mint& r) const noexcept { return mint(*this) *= r; }
  constexpr mint operator / (const mint& r) const noexcept { return mint(*this) /= r; }
  constexpr mint& operator += (const mint& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr mint& operator -= (const mint& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr mint& operator *= (const mint& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr mint& operator /= (const mint& r) noexcept {
    int a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      int t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator == (const mint& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator != (const mint& r) const noexcept {
    return this->val != r.val;
  }
  friend ostream& operator << (ostream &os, const mint& x) noexcept {
    return os << x.val;
  }
  friend istream& operator >> (istream &is, mint& x) noexcept {
    return is >> x.val;
  }
  friend constexpr mint powMod(const mint &a, int n) noexcept {
    if (n == 0) return 1;
    auto t = powMod(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};

const int MAX = 200020;
mint ten[MAX], one[MAX];

struct S {
  mint x;
  int w;
  S(mint x = 0, int w = 0): x(x), w(w) {}
};

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

S mapping(int f, S s){
  if(f == 0) return s;
  return S(one[s.w]*f, s.w);
}
int conposition(int f, int g){
  if(f == 0) return g;
  return f;
}
int id(){
  return 0;
}

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

  ten[0] = 1; one[0] = 0;
  REP(i, MAX-1){
    ten[i+1] = ten[i]*10;
    one[i+1] = one[i]*10+1;
  }

  vector<S> v(N, S(1, 1));
  lazy_segtree<S, op, e, int, mapping, conposition, id> seg(v);

  REP(i, Q){
    int l, r, d;
    cin >> l >> r >> d;
    seg.apply(l-1, r, d);
    cout << seg.all_prod().x << "\n";
  }

  return 0;
}


Measured memory_bytes: 19848