#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

template<typename M, typename N>
istream& operator>>(istream&is, pair<M,N> & p){is >> p.first >> p.second; return is;}
template<typename M>
istream& operator>>(istream&is, vector<M> & v){for(auto &it:v) is >> it; return is; }
template<typename M>
istream& operator>>(istream&is, vector<vector<M>> & v){for(auto &it:v) is >> it; return is; }
template<typename M, typename N>
ostream& operator<<(ostream&os, const pair<M,N> &p){os << p.first << ' ' << p.second << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<M> &v){for(auto it: v)os << it << ' ';cout << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<vector<M>> &v){for(auto it: v)os << it;return os;}

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define acc(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+10;
//const int mod=1000000007;
const int mod=998244353;

int n,m,k;
const int N=3e5+10;


struct lazy_segtree {
    struct node{
        ll sum,ans,lazy;
        node(): lazy(-1){};
    };
    vector<node> st;
    long long int ans=0;
    int n;
    
    void push(int u){
        if(~st[u].lazy){
            st[2*u].lazy=st[u].lazy;
            st[2*u+1].lazy=st[u].lazy;
            st[u].lazy=-1;
            st[2*u].ans=st[2*u].sum*st[2*u].lazy%mod;
            st[2*u+1].ans=st[2*u+1].sum*st[2*u+1].lazy%mod;
        }
    }
    template<typename M>
    lazy_segtree(vector<M> &a){
        n=(int)a.size();
        st.resize(4*n);
        build(1, 0, n-1, a);
    }
    
    void combine(node &a,node &b,node &c){
        (a.sum=b.sum+c.sum)%=mod;
        (a.ans=b.ans+c.ans)%=mod;
    }
    template <typename M>
    void build(int v,int l,int r, vector<M> &vec){
        if (l==r) {
            st[v].lazy=-1;
            st[v].sum=vec[l];
            st[v].ans=vec[l];
        }
        else{
            int m=(l+r)/2;
            build(2*v, l, m ,vec);
            build(2*v+1, m+1, r , vec);
            combine(st[v], st[2*v], st[2*v+1]);
        }
    }
    node query(int v,int l,int r,int l_,int r_){
        if (l==l_&&r==r_) {
            return st[v];
        }
        push(v);
        int m=(l+r)/2;
        if (r_<=m) {
            return query(2*v, l, m, l_, r_);
        }
        else if (l_>m){
            return query(2*v+1, m+1, r, l_, r_);
        }
        else{
            node a,b,c;
            b=query(2*v, l, m, l_, m);
            c=query(2*v+1, m+1, r, m+1, r_);
            combine(a, b, c);
            return a;
        }
    }
    void update(int v,int l,int r,int l_,int r_,ll k){
        if (l==l_&&r==r_) {
            st[v].lazy=k;
            if(l!=r)push(v);
            st[v].ans=st[v].sum*k%mod;
            return ;
        }
        push(v);
        int m=(l+r)/2;
        if (r_<=m) {
            update(2*v, l, m, l_, r_, k);
        }
        else if (l_>m){
            update(2*v+1, m+1, r, l_, r_, k);
        }
        else{
            update(2*v, l, m, l_, m, k);
            update(2*v+1, m+1, r, m+1, r_, k );
        }
        combine(st[v], st[2*v], st[2*v+1]);
    }
    
    long long int query(int l,int r){
        return query(1, 0, n-1, l, r).ans;
    }
    
    void update(int l, int r, int val){
        update(1, 0, n-1, l, r, val);
    }
    
};



int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    vll vv(n+1,1);
    for(int i=n-1; i>0; i--){
        (vv[i]=vv[i+1]*10)%=mod;
    }

    lazy_segtree st(vv);
    for(int i=0, u , v, k; i<q; i++){
        cin >> u >> v >> k;
        st.update(u,v,k);
        cout <<  st.query(1,n) << el;
    }
    
    
    
    return 0;
}








Measured memory_bytes: 23504