#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define Local
#ifdef Local
    #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
    void err() { std::cout << std::endl; }
    template<typename T, typename...Args>
    void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
    template <template<typename...> class T, typename t, typename... A> 
    void err(const T <t> &arg, const A&... args) {
    for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
    #define dbg(...)
#endif
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
const ll mod = 998244353;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int N = 2e5 + 10;

int n, q;
ll f[N],fsum[N];

struct segTree{
    int n;
    ll sum[N << 2],add[N << 2];
    inline int ls(int x) { return x << 1; }
    inline int rs(int x) { return x << 1 | 1; }

    void init(int x) { n = x; }
    
    void pushup(int o){
        sum[o] = (sum[ls(o)] + sum[rs(o)]) % mod;
        add[o] = 0;
    }
    
    void build(ll a[], int o, int l, int r) {
        if(l == r) {
            sum[o] = a[l];
            add[o] = 0;
            return;
        }
        int mid = l + r >> 1;
        build(a,ls(o),l,mid);
        build(a,rs(o),mid + 1,r);
        pushup(o);
    }
    
    void up_ch(int o, int l, int r, ll v){
        add[o] = v;
        sum[o] = (fsum[l] - fsum[r + 1] + mod) % mod * v % mod;
    }
    
    void pushdown(int o, int l, int r) {
        if(add[o]) {
            int mid = l + r >> 1;
            up_ch(ls(o),l,mid,add[o]);
            up_ch(rs(o),mid + 1,r,add[o]);
            add[o] = 0;
        }
    }
    
    void update(int ql, int qr, int o, int l, int r, ll v) {
        if(qr < l || ql > r) return;
        if(ql <= l && qr >= r) {
            up_ch(o,l,r,v);
            return;
        }
        //在更新子区间之前先下传懒标记
        pushdown(o,l,r);
        int mid = l + r >> 1;
        update(ql,qr,ls(o),l,mid,v);
        update(ql,qr,rs(o),mid + 1,r,v);
        pushup(o);
    }
    
    ll qsum(int ql, int qr, int o, int l, int r){
        if(qr < l || ql > r) return 0;
        if(ql <= l && qr >= r) return sum[o] % mod;
        //查询之前如果要到子区间中去，先下传懒标记
        pushdown(o,l,r);
        int mid = l + r >> 1;
        return (qsum(ql,qr,ls(o),l,mid) % mod + qsum(ql,qr,rs(o),mid + 1,r) % mod) % mod;
    }
    
    void build(ll a[]) { build(a,1,1,n); }

	void update(int l, int r, ll v) { update(l,r,1,1,n,v); }

	ll qsum(int l, int r) { return qsum(l,r,1,1,n) % mod; }
    
}st;

int main()
{
    fastIO;
    cin >> n >> q;
    f[1] = 1;
    for(int i = 2; i <= n; ++i) f[i] = f[i - 1] * 10 % mod;
    for(int i = 1; i <= n; ++i) fsum[i] = (fsum[i - 1] + f[i]) % mod; 
    //dbg(fsum[1], fsum[2], f[1], f[2]);
    reverse(f + 1, f + 1 + n);
    reverse(fsum + 1, fsum + 1 + n);
    st.init(n);
    st.build(f);

    while (q--) {
        int l, r, v;
        cin >> l >> r >> v;
        st.update(l, r, v);
        cout << st.qsum(1, n) << endl;
    }

    return 0;
}

Measured memory_bytes: 15012