//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;

//const ll MOD = 1000000007;
const ll MOD = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        return mint(*this) /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

vector<mint> p(200200), cum(200200);

template<class T, class S>
struct LazySegTree {
    using OP = function<T(T, T)>;  // function type for operation
    using UP_D = function<void(T&, S)>; // function type for data updater
    using UP_L = function<void(S&, S)>; // function type for lazy updater

    OP op;
    UP_D up_d;
    UP_L up_l;
    T ue_d;
    S ue_l; // unit element for dat and lazy
    int N;
    vector<T> dat;
    vector<S> lazy;

    int get_n(int n) {
        int ret = 1;
        while (ret < n) ret <<= 1;

        return ret;
    }

    explicit LazySegTree(int n,
                         // todo : ↓↓↓ edit from here ↓↓↓
                         const OP _op = [](T a, T b){return T(mint(p[b.se] * a.fi + b.fi), a.se + b.se);},
                         const UP_D _up_d = [](T &dt, S lz) { if (lz > 0) dt.first = cum[dt.se - 1] * lz; },
                         const UP_L _up_l = [](S &lz, S v) { lz = v; },
                         const T _ue_d = T(0, 0),
                         const S _ue_l = 0)
            : op(_op), up_d(_up_d), up_l(_up_l), ue_d(_ue_d), ue_l(_ue_l) {
        N = get_n(n);
        dat.assign(N * 2 - 1, ue_d);
        lazy.assign(N * 2 - 1, ue_l);
    }

    /* set, a is 0-indexed */
    void init(const T& v) {
        REP(i, N) dat[i + N - 1] = v;
        for(int i = N - 2; i >= 0; --i) {
            dat[i] = op(dat[i*2+1], dat[i*2+2]);
        }
    }

    inline void evaluate(int k) {
        if (lazy[k] == ue_l) return;

        if (k < N - 1) {
            up_l(lazy[k * 2 + 1], lazy[k]);
            up_l(lazy[k * 2 + 2], lazy[k]);
        }

        up_d(dat[k], lazy[k]);
        lazy[k] = ue_l;
    }

    // update [a, b). 0-indexed!!!!!!!!!!!
    void update(int a, int b, const S &v, int k = 0, int l = 0, int r = -1) {
        evaluate(k);
        if (r < 0) r = N;

        if (r <= a || b <= l) return;

        if (a <= l && r <= b) {
            up_l(lazy[k], v);
            evaluate(k);
            return;
        }

        int mid = (l + r) / 2;
        update(a, b, v, k * 2 + 1, l, mid);
        update(a, b, v, k * 2 + 2, mid, r);

        dat[k] = op(dat[k * 2 + 1], dat[k * 2 + 2]);
    }

    // update single position
    void update(int i, const S &v) {
        update(i, i+1, v);
    }

    // query for [a, b). 0-indexed!!!!!!!!!!!
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;

        if (r <= a || b <= l) return ue_d;

        evaluate(k);
        if (a <= l && r <= b) return dat[k];

        int mid = (l + r) / 2;
        T q1 = query(a, b, k * 2 + 1, l, mid);
        T q2 = query(a, b, k * 2 + 2, mid, r);

        return op(q1, q2);
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, q; cin >> n >> q;

    p[0] = 1;
    REP(i, n) {
        p[i + 1] = p[i] * 10;
    }

    cum[0] = p[0];
    REP(i, n) {
        cum[i + 1] += p[i + 1] + cum[i];
    }

    LazySegTree<pair<mint, int>, ll> st(n);
    st.init(make_pair(mint(1), 1));

    REP(i, q) {
        int l, r, d; cin >> l >> r >> d;
        --l, --r;

        st.update(l, r+1, d);

        print(st.query(0, n).first);
    }
}


Measured memory_bytes: 18788