#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ff               first
#define ss               second
#define pb               push_back
#define all(x)           (x).begin(), (x).end()
#define mem0(x)          memset(x, 0, sizeof (x))
#define mem1(x)          memset(x, -1, sizeof (x))

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector <ii> vii;
typedef vector<vii> vvii;
typedef vector <ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;

const int MOD = 998244353;
int N;

ll pot10[200010];

struct Node
{
    static ll const neutro = 0;
    static ll op(ll x, ll y) { return (x + y)%MOD; }
    static ll lazy_op(int i, int j, ll x) {
        ll pot = pot10[j];
        if (i) pot -= pot10[i-1];
        pot = (pot + MOD)%MOD;
        return x * pot%MOD;
    }
};

// 0 - indexed / inclusive - inclusive
template <class t>
class STL
{
    vector<ll> arr, st, lazy;
    int n;
    void build(int u, int i, int j)
    {
        if (i == j) { st[u] = arr[i]; return; }
        int m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
        build(l, i, m); build(r, m + 1, j);
        st[u] = t::op(st[l], st[r]);
    }

    void propagate(int u, int i, int j, ll x)
    {
        //st[u] += t::lazy_op(i, j, x); // incrementar el valor (+)
        st[u] = t::lazy_op(i, j, x); // setear el valor
        if (i != j)
        {
            //lazy[u * 2 + 1] += x;
            //lazy[u * 2 + 2] += x;
            lazy[u * 2 + 1] = x;
            lazy[u * 2 + 2] = x;
        }
        lazy[u] = 0;
    }

    ll query(int a, int b, int u, int i, int j)
    {
        if (j < a or b < i) return t::neutro;
        int m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
        if (lazy[u]) propagate(u, i, j, lazy[u]);
        if (a <= i and j <= b) return st[u];
        ll x = query(a, b, l, i, m);
        ll y = query(a, b, r, m + 1, j);
        return t::op(x, y);
    }

    void update(int a, int b, ll value, int u, int i, int j)
    {
        int m = (i + j) / 2, l = u * 2 + 1, r = u * 2 + 2;
        if (lazy[u]) {
            propagate(u, i, j, lazy[u]);
        }
        if (a <= i and j <= b) propagate(u, i, j, value);
        else if (j < a or b < i) return;
        else
        {
            update(a, b, value, l, i, m);
            update(a, b, value, r, m + 1, j);
            st[u] = t::op(st[l], st[r]);
        }
    }

public:
    STL(vector<ll> &v)
    {
        arr = v; n = v.size();
        st.resize(n * 4 + 5);
        lazy.assign(n * 4 + 5, 0);
        build(0, 0, n - 1);
    }

    ll query(int a, int b) { return query(a, b, 0, 0, n - 1); }

    void update(int a, int b, ll value) { update(a, b, value, 0, 0, n - 1); }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T=1, n, q;
    pot10[0] = 1;
    cin >> n >> q;
    N = n;
    vll A(n, 0);
    for (int i = 1; i < n+5; ++i) pot10[i] = (10ll*pot10[i-1]%MOD);

    for (int k = 1; k < n+5; ++k) pot10[k] = (pot10[k] + pot10[k-1])%MOD;
    STL <Node> stl(A);
    stl.update(0,n-1, 1);
    for (int j = 0; j < q; ++j) {
        int l, r, d;
        cin >> l >> r >> d;
        l = n-l;
        r = n-r;
        swap(l, r);
        stl.update(l,r,d);
        cout << stl.query(0,n-1) << "\n";
    }
}

Measured memory_bytes: 20352