// Date created: "20:03:17, 27-09-2020"
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Silent_voice
#define endl "\n"

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 2e5, MOD = 998244353;

LL n, a[MaxN], q, pw[MaxN], dw[MaxN];

class Node{
    public:
        LL val, lazy, l, r;

        LL operator + (const Node &op) const {
            LL temp = (val * pw[op.r - op.l + 1]) % MOD;
            temp = (temp + op.val) % MOD;
            return temp;
        }
};

class Tree{

    Node TNode[4 * MaxN];
    LL qi, qj, ch;

    void Push(LL node){
        LL temp = TNode[node].lazy;
        if(temp == 0) return;
        TNode[node * 2].val = (temp * dw[TNode[node * 2].r - TNode[node * 2].l + 1]) % MOD;
        TNode[node * 2].lazy = temp;
        TNode[node * 2 + 1].val = (temp * dw[TNode[node * 2 + 1].r - TNode[node * 2 + 1].l + 1]) % MOD;
        TNode[node * 2 + 1].lazy = temp;
        TNode[node].lazy = 0;
    }

    void Change(LL node){
        if(TNode[node].l > qj || TNode[node].r < qi) return;
        if(qi <= TNode[node].l && TNode[node].r <= qj){
            TNode[node].val = (ch * dw[TNode[node].r - TNode[node].l + 1]) % MOD;
            TNode[node].lazy = ch;
            return;
        }
        Push(node);
        Change(node * 2);
        Change(node * 2 + 1);
        TNode[node].val = TNode[node * 2] + TNode[node * 2 + 1];
    }

    public:
        void Create(LL node, LL l, LL r){
            TNode[node].l = l;
            TNode[node].r = r;
            if(l == r){
                TNode[node].val = 1;
                return;
            }
            Create(node * 2, l, (l + r) / 2);
            Create(node * 2 + 1, (l + r) / 2 + 1, r);
            TNode[node].val = TNode[node * 2] + TNode[node * 2 + 1];
        }

        void Update(LL l, LL r, LL val){
            qi = l;
            qj = r;
            ch = val;
            Change(1);
        }

        LL Query(){
            return TNode[1].val;
        }
} tr;

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    // InOut();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> q;
    pw[0] = 1;
    dw[1] = 1;
    for(int i = 2 ; i < MaxN ; ++i) dw[i] = (dw[i - 1] * 10 + 1) % MOD;
    for(int i = 1 ; i < MaxN ; ++i) pw[i] = (pw[i - 1] * 10) % MOD;
    tr.Create(1, 1, n);
    for(int i = 0 ; i < q ; ++i){
        LL x, y, z;
        cin >> x >> y >> z;
        tr.Update(x, y, z);
        cout << tr.Query() << endl;
    }

    return 0;
}

Measured memory_bytes: 23164