#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>
#include <atcoder/lazysegtree.hpp>

using namespace std;

namespace utils{
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
    ///----- aliases
    using ll = long long int;
    using ull = unsigned long long;

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> inline bool CHMIN(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> inline bool CHMAX(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

    ///----- vector I/O
    template<class T>
    vector<T> VEC(size_t n, T t){
        return vector<T>(n, t);
    }

    template<class ...Ts>
    auto VEC(size_t n, Ts ... ts){
        return vector<decltype(VEC(ts...))>(n, VEC(ts...));
    }


    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        auto p = v.begin();
        assert(p != v.end());
        os << *p++;
        while(p != v.end()){
            os << ' ' << *p++;
        }
        return os ;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<vector<T>>& v){
        auto p = v.begin();
        assert(p != v.end());
        os << *p++;
        while(p != v.end()){
            os << '\n' << *p++;
        }
        return os;
    }

    ///----- tuple I/O
    template <class S, class T>
    istream& operator>>(istream& is, tuple<S, T>& t){
        return is >> get<0>(t) >> get<1>(t);
    }

    template <class S, class T>
    istream& operator>>(istream& is, pair<S, T>& t){
        return is >> get<0>(t) >> get<1>(t);
    }

    template <class S, class T, class U>
    istream& operator>>(istream& is, tuple<S, T, U>& t){
        return is >> get<0>(t) >> get<1>(t) >> get<2>(t);
    }

    template <class S, class T>
    ostream& operator<<(ostream& os, const tuple<S, T>& t){
        return os << get<0>(t) << ' ' <<  get<1>(t);
    }

    template <class S, class T>
    ostream& operator<<(ostream& os, const pair<S, T>& t){
        return os << get<0>(t) << ' ' <<  get<1>(t);
    }

    template <class S, class T, class U>
    ostream& operator<<(ostream& os, const tuple<S, T, U>& t){
        return os << get<0>(t) << ' ' <<  get<1>(t) << ' ' <<  get<2>(t);
    }

    ///----- constants
    constexpr ll INFLL   = 1'000'000'000'000'000'020ll;
    constexpr ll INF     = 1'000'000'009;
    constexpr double PI      = 3.14'159'265'358'979'323'846;
    constexpr double EPS     = 1e-12;
}
using namespace utils;

namespace xelm_ModInt {
    class ModInt {
        static constexpr int64_t NIL = -1;
//        static constexpr int64_t MOD = 1'000'000'007;
        static constexpr int64_t MOD = 998'244'353;

        ll val;
    public:
        ModInt(long long x) : val(x >= 0 ? x % MOD : MOD - (-x) % MOD) {}
        ModInt(signed x) : val(x >= 0 ? x % MOD : MOD - (-x) % MOD) {}
        ModInt(unsigned long long x) : val(x % MOD) {}
        ModInt(unsigned x) : val(x % MOD) {}
        ModInt() : val{NIL} {}

        bool is_nil() { return val == NIL; }

        ModInt pow(long long n) const {
            long long r = 1, a = val;
            while (n) {
                if (n & 1) {
                    r *= a;
                    r %= MOD;
                }
                a *= a;
                a %= MOD;
                n /= 2;
            }
            return {r};
        }
        ModInt inv() const { /* return Inverse */ assert(val != 0);
            return this->pow(MOD - 2);
        }

        void operator+=(const ModInt &a) {
            val += a.val;
            if (val >= MOD) val -= MOD;
        }
        void operator-=(const ModInt &a) {
            val -= a.val;
            if (val < 0) val += MOD;
        }
        void operator*=(const ModInt &a) {
            val *= a.val;
            val %= MOD;
        }
        void operator/=(const ModInt &a) {
            val *= a.inv().val;
            val %= MOD;
        }

        ModInt operator+(const ModInt &x) const {
            long long v = val + x.val;
            return {v};
        }
        ModInt operator-(const ModInt &x) const {
            long long v = val - x.val;
            return {v};
        }
        ModInt operator*(const ModInt &x) const {
            long long v = val * x.val;
            return {v};
        }
        ModInt operator/(const ModInt &x) const {
            long long v = val * x.inv().val;
            return {v};
        }

        bool operator==(const ModInt &x) const { return x.val == val; }
        bool operator!=(const ModInt &x) const { return x.val != val; }

        friend istream &operator>>(istream &is, ModInt &r) {
            long long tmp;
            is >> tmp;
            r = tmp;
            return is;
        }
        friend ostream &operator<<(ostream &os, const ModInt &r) { return os << r.val; }
    };

    std::vector<ModInt> fact_memo, fact_inv_memo;

    ModInt __dont_memorized_factorial(long long n) {
        ModInt ans = 1;
        for (int i = 1; i < n; ++i) {
            ans *= i;
        } // end i
        return ans;
    }

    void fact_init(long long n) {
        fact_memo.resize(n + 1);
        fact_memo[0] = 1;
        for (long long i = 1; i <= n; ++i) {
            fact_memo[i] = fact_memo[i - 1] * i;
        } // end i

        fact_inv_memo.resize(n + 1);
        fact_inv_memo.back() = fact_memo[n].inv();
        for (long long i = n; i > 0; --i) {
            fact_inv_memo[i - 1] = fact_inv_memo[i] * i;
        } // end i
    }

    ModInt fact(long long n) {
        assert(fact_memo.size() > n);
        return fact_memo[n];
    }

    /// n! / k!(n-k!)
    /// k is small
    ModInt choose0(long long n, long long k) {
        if (k > n or k < 0 or n < 0) return 0;
        ModInt ans = 1;
        for (int i = 1; i <= k; ++i) {
            ans *= (n - i + 1);
        } // end i
        ans *= fact_inv_memo[k];
        return ans;
    }

    /// n and k is small
    ModInt choose1(long long n, long long k) {
        if (k > n or k < 0 or n < 0) return 0;
        assert(fact_memo.size() > n);
        ModInt ans = fact_memo[n] * fact_inv_memo[k] * fact_inv_memo[n - k];
        return ans;
    }

    ModInt operator "" _mod(unsigned long long x) {
        return ModInt{x};
    }
}
using namespace xelm_ModInt;

using F = ModInt;


vector<ModInt> pow10(300000);
vector<ModInt> oneone(300000);

struct S{
    ModInt val;
    int dig;
};

S op(S l, S r){
    return {l.val*pow10[r.dig] + r.val, l.dig + r.dig};
}

S e(){ return {0_mod, 0}; }

S mapping(F x, S y){
    if(x == 0) return y;
    return {x*oneone[y.dig], y.dig};
}

F composition(F f, F g){
    if(f == 0) return g;
    return f;
}

F id(){ return 0; }

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}

    int N, Q;
    bool input() {
        is >> N >> Q;
        return !!is;
    }

    void run();
};

void solver::run(){
    if(!input()) return;

    pow10[0] = 1;
    for (int i = 1; i < pow10.size(); ++i) {
        pow10[i] = pow10[i-1] * 10;
    } // end i
    oneone[0] = 0;
    for (int i = 1; i < oneone.size(); ++i) {
        oneone[i] = oneone[i-1] * 10 + 1;
    } // end i

    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
//    seg.apply(0, N, 1);

    for (int k = 0; k < N; ++k) {
        seg.set(k, {1, 1});
//        os << seg.get(k).val;
    } // end i
//    os << endl;
//    os << mapping(1, {0, 1}).val << endl;
    for (int i = 0; i < Q; ++i) {
        int l, r, d;
        is >> l >> r >> d;
        l--;
        seg.apply(l, r, d);
        os << seg.all_prod().val << endl;
    } // end i
}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef XELMH
    string test_cases = "test_ee.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


Measured memory_bytes: 21376