#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) { return vector<T>(a, n); }
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); }
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <long long mod>
class Fp {
private:
    long long val;

public:
    Fp() { val = 0; }
    Fp(long long v) : val(v % mod) {
        if (val < 0)
            val += mod;
    }
    Fp getVal() { return val; }
    Fp operator+=(const Fp &in) {
        val += in.val;
        if (val >= mod)
            val -= mod;
        return *this;
    }
    Fp operator+(const Fp &in) const {
        return Fp(*this) += in;
    }
    Fp &operator-=(const Fp &in) {
        val -= in.val;
        if (val < 0)
            val += mod;
        return *this;
    }
    Fp operator-(const Fp &in) const {
        return Fp(*this) -= in;
    }
    Fp &operator*=(const Fp &in) {
        val = val * in.val % mod;
        return *this;
    }
    Fp operator*(const Fp &in) const {
        return Fp(*this) *= in;
    }
    friend Fp operator*(const long long n, const Fp &in) {
        return in * n;
    }
    Fp &operator/=(const Fp &in) {
        *this *= in.modpow(mod - 2);
        return *this;
    }
    Fp operator/(const Fp &in) const {
        return Fp(*this) /= in;
    }
    bool operator==(const Fp &in) const {
        return val == in.val;
    }
    bool operator!=(const Fp &in) const {
        return val != in.val;
    }
    Fp modpow(long long n) const {
        if (n == 0)
            return 1;
        if (n & 1) {
            return (*this) * ((*this) * (*this)).modpow(n / 2);
        } else {
            return ((*this) * (*this)).modpow(n / 2);
        }
    }
    friend istream &operator>>(istream &is, Fp &fp) {
        long long res;
        is >> res;
        fp = res;
        return is;
    }
    friend ostream &operator<<(ostream &os, Fp &fp) {
        os << fp.val;
        return os;
    }
    friend ostream &operator<<(ostream &os, Fp &&fp) {
        os << fp.val;
        return os;
    }
};

//using mint = Fp<1000000007>;
using mint = Fp<998244353>;

mint modpow(const mint &in, const long long n) {
    return in.modpow(n);
}
mint modpow(const ll a, const long long n) {
    return mint(a).modpow(n);
}

class Factorial {
public:
    vector<mint> fact, finv;
    Factorial(long long n) : fact(n + 1, mint(1)), finv(n + 1, mint(1)) {
        for (int i = 2; i <= n; i++) {
            mint tmp(i);
            fact[i] = fact[i - 1] * tmp;
            finv[i] = finv[i - 1] / tmp;
        }
    }
    mint perm(const long long n, const long long k) {
        return fact[n] * finv[n - k];
    }
    mint com(const long long n, const long long k) {
        if (n < k || n < 0 || k < 0)
            return mint(0);
        return fact[n] * finv[k] * finv[n - k];
    }
};

template <class X,
          X (*fxx)(X, X),
          X (*iex)(),
          class Y,
          Y (*fyy)(Y, Y),
          Y (*iey)(),
          X (*fxy)(X, Y)>
class LazySegmentTree {
public:
    vector<X> data;
    vector<Y> lazy;
    int orgSize;
    int size;

    LazySegmentTree(int n) : orgSize(n) {
        auto v = vector<X>(n, iex());
        initialize(v);
    }

    LazySegmentTree(vector<X> &v) : orgSize((int)v.size()) {
        initialize(v);
    }

    LazySegmentTree(vector<X> &&v) : LazySegmentTree(v) {}

    void initialize(vector<X> &v) {
        size = 1;
        while (size < orgSize)
            size *= 2;
        data.resize(2 * size - 1, iex());
        lazy.resize(2 * size - 1, iey());

        for (int i = 0; i < orgSize; i++)
            data[i + size - 1] = v[i];

        for (int i = size - 2; i >= 0; i--)
            data[i] = fxx(data[i * 2 + 1], data[i * 2 + 2]);
    }

    void lazyEvaluate(int k) {
        if (lazy[k] != iey()) {
            data[k] = fxy(data[k], lazy[k]);
            if (k < size - 1) {
                lazy[k * 2 + 1] = fyy(lazy[k * 2 + 1], lazy[k]);
                lazy[k * 2 + 2] = fyy(lazy[k * 2 + 2], lazy[k]);
            }
            lazy[k] = iey();
        }
    }

    void apply(int index) {
        return apply(index, index + 1);
    }

    void apply(int a, int b, Y y, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = size;
        lazyEvaluate(k);
        if (b <= l || r <= a)
            return;
        if (a <= l && r <= b) {
            lazy[k] = fyy(lazy[k], y);
            lazyEvaluate(k);
        } else {
            apply(a, b, y, 2 * k + 1, l, (l + r) / 2);
            apply(a, b, y, 2 * k + 2, (l + r) / 2, r);
            data[k] = fxx(data[2 * k + 1], data[2 * k + 2]);
        }
    }

    X query(int index) {
        return query(index, index + 1);
    }

    X query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = size;
        lazyEvaluate(k);
        //dump(a, b, l, r, k, data[k]);
        if (b <= l || r <= a)
            return iex();
        if (a <= l && r <= b)
            return data[k];
        X vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        X vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        //dump(a, b, l, r, k, data[k], vl, vr);
        return fxx(vl, vr);
    }

    void debug() {
#ifdef LOCAL
        cout << "debug : ";
        for (int i = 0; i < orgSize; i++) {
            cout << query(i) << (i != orgSize - 1 ? " " : "");
        }
        cout << endl;
#endif
    }

    void debugALL() {
#ifdef LOCAL
        cout << "--------start--------" << endl;
        for (int i = 0; i < 2 * size - 1; i++)
            lazyEvaluate(i);
        long long cnt = 1;
        for (int i = 0; i < 2 * size - 1; i++) {
            cout << data[i];
            if (i == cnt - 1) {
                cout << endl;
                cnt = cnt * 2 + 1;
            } else {
                cout << " ";
            }
        }
        cout << "---------end---------" << endl;
#endif
    }
};

//Range Minimum Query and Range Update Apply
namespace RMQRUA {
    using X = int;
    X iex() { return numeric_limits<X>::max(); }
    X fxx(X x1, X x2) { return min(x1, x2); }
    using Y = int;
    Y iey() { return numeric_limits<Y>::max(); }
    Y fyy(Y y1, Y y2) { return y2; }
    X fxy(X x1, Y y1) { return y1; }
    using LST = LazySegmentTree<X, fxx, iex, Y, fyy, iey, fxy>;
} // namespace RMQRUA

//Range Minimum Query and Range Add Apply
namespace RMQRAA {
    using X = int;
    X iex() { return numeric_limits<X>::max(); }
    X fxx(X x1, X x2) { return min(x1, x2); }
    using Y = int;
    Y iey() { return 0; }
    Y fyy(Y y1, Y y2) { return y1 + y2; }
    X fxy(X x1, Y y1) {
        if (x1 == iex())
            return x1;
        return x1 + y1;
    }
    using LST = LazySegmentTree<X, fxx, iex, Y, fyy, iey, fxy>;
} // namespace RMQRAA

//Range Sum Query and Range Update Apply
namespace RSQRUA {
    using X = int;
    X iex() { return 0; }
    X fxx(X x1, X x2) { return x1 + x2; }
    using Y = int;
    Y iey() { return 0; }
    Y fyy(Y y1, Y y2) { return y2; }
    X fxy(X x1, Y y1) { return y1; }
    using LST = LazySegmentTree<X, fxx, iex, Y, fyy, iey, fxy>;
} // namespace RSQRUA

//Range Sum Query and Range Add Apply
namespace RSQRAA {
    using X = pair<int, int>;
    X iex() { return {0, 1}; }
    X fxx(X x1, X x2) { return {x1.first + x2.first, x1.second + x2.second}; }
    using Y = int;
    Y iey() { return 0; }
    Y fyy(Y y1, Y y2) { return y1 + y2; }
    X fxy(X x1, Y y1) { return {x1.first + x1.second * y1, x1.second}; }
    using LST = LazySegmentTree<X, fxx, iex, Y, fyy, iey, fxy>;
} // namespace RSQRAA
ostream &operator<<(ostream &os, RSQRAA::X x) {
    os << x.first;
    return os;
}

vector<mint> a(200100);

namespace solve {
    using X = pair<mint, int>;
    X iex() { return {0, 0}; }
    X fxx(X x1, X x2) { return {x1.first * modpow(10, x2.second) + x2.first, x1.second + x2.second}; }
    using Y = mint;
    Y iey() { return 0; }
    Y fyy(Y y1, Y y2) { return y2; }
    X fxy(X x1, Y y1) { return {a[x1.second] * y1, x1.second}; }
    using LST = LazySegmentTree<X, fxx, iex, Y, fyy, iey, fxy>;
} // namespace solve

signed main() {
    INIT;
    REP(i, a.size()) {
        a[i + 1] = a[i] * 10 + 1;
    }
    cin >> N >> Q;
    vector<solve::X> v(N, {1, 1});
    solve::LST seg(v);
    REP(_, Q) {
        cin >> L >> R >> D;
        seg.apply(L - 1, R, D);
        cout << seg.query(0, N).first << endl;
    }
}

Measured memory_bytes: 20052