#include<bits/stdc++.h>
using namespace std;
#define int long long

#define rep(i,n) for (int i = 0; i < n; i++)
#define repd(i,n) for (int i = n-1; i >= 0; i--)
#define fo(i,a,b) for (int i = a; i < b; i++)
#define fod(i,a,b) for (int i = a; i >= b; i--)
#define umap unordered_map
#define mii map<int,int>
#define pii pair<int,int>
#define vc vector
#define vi vc<int>
#define vvi vc<vi>
#define pqmin priority_queue<int,vector<int>,greater<int>>
#define pqmax priority_queue<int>
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define w(t) int t; cin>>t; while (t--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define out(x) cout<<x<<endl;
#define print(a, n) rep (i, n) cout<<a[i]<<" "; cout<<endl;
#define clr(a, x) memset(a, x, sizeof a)

const int mod = 1e9+7;
const int mod2 = 998244353;
const int N = 2e5;
const int inf = 1e18;

//=====================================================


template<typename... T>
void read(T&... args) {((cin >> args), ...);}
template<typename... T>
void write(T&&... args) {((cout << args << " "), ...);}
template<typename... T>
void writeline(T&&... args) {((cout << args << " "), ...); cout << endl;}

int add(int a,int b,int mod){int res=(a+b)%mod;return (res<0)?res+mod:res;}
int mul(int a,int b,int mod){int res=(a*1LL*b)%mod;return (res<0)?res+mod:res;}
string binary(int x) {string res = ""; rep(i, 32) res += (1<<i & x)?'1':'0'; return res; }
int in(int x, int y, int z) { if (y > z) swap(y, z); return (x >= y && x <= z);}
struct customCompare {
    bool operator () (pii x, pii y) {
        return x.first > y.second;
    }
};

//=====================================================

int tree[1048576], lazy[1048576];
int p[N+5];
int mod9, n, q;

int ModExp(int x, int y, int m){
    int res = 1;
    while (y > 0) {
        if (y & 1) res = (res*x) % m;
        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void update (int i, int j, int l, int r, int k, int x) {
    if (i > j)
        return;

    if (lazy[k] != 0) {
        int res = (mod2 + p[j-i+1]-1)%mod2;
        res = (res * mod9)%mod2;
        res = (res * lazy[k])%mod2;
        res = (res * p[n-j])%mod2;
        tree[k] = res;

        if (i != j) 
            lazy[2*k] = lazy[2*k+1] = lazy[k];
        lazy[k] = 0;
    }

    if (i > r || j < l) 
        return;

    if (i >= l && r >= j) {
        int res = (mod2 + p[j-i+1]-1)%mod2;
        res = (res * mod9)%mod2;
        res = (res * x)%mod2;
        res = (res * p[n-j])%mod2;
        tree[k] = res;

        if (i != j) 
            lazy[2*k] = lazy[2*k+1] = x;
        
        return;
    }

    int mid = (i+j)/2;
    update (i, mid, l, r, 2*k, x);
    update (mid+1, j, l, r, 2*k+1, x);
    tree[k] = (tree[2*k] + tree[2*k+1])%mod2;
}

void solve() {
    cin >> n >> q;

    mod9 = ModExp(9, mod2-2, mod2);
    p[0] = 1;
    fo (i, 1, n+1) {
        p[i] = (p[i-1]*10)%mod2;
    }

    fo (i, 1, n+1) {
        update(1, n, i, i, 1, 1);
    }

    while (q--) {
        int l, r, d;
        read(l,r,d);

        update(1, n, l, r, 1, d);
        cout << tree[1] << endl;
    }
}

int32_t main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(0); cout.tie(0);


    solve();

    return 0;                                           
}

Measured memory_bytes: 13384