// Template
#include "bits/stdc++.h"
#include "atcoder/all"
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T>
inline bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T> 
inline bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}
struct IOSET {
    IOSET() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} ioset;

// Mod-Int
template <int MOD> // MOD > 1
struct ModInt {
    long long val;
    ModInt() = default;
    ModInt(long long x) : val(x % MOD + (x < 0 ? MOD : 0)) {}
    ModInt<MOD> &operator+= (const ModInt<MOD> &x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt<MOD> &operator-= (const ModInt<MOD> &x) {
        if ((val -= x.val) < 0) val += MOD; 
        return *this;
    }
    ModInt<MOD> &operator*= (const ModInt<MOD> &x) {
        (val *= x.val) %= MOD; return *this;
    }
    ModInt<MOD> operator+ (const ModInt<MOD> &x) const {
        return ModInt(*this) += x;
    }
    ModInt<MOD> operator- (const ModInt<MOD> &x) const {
        return ModInt(*this) -= x;
    }
    ModInt<MOD> operator* (const ModInt<MOD> &x) const {
        return ModInt(*this) *= x;
    }
    ModInt<MOD> pow(long long t) const {
        assert(t >= 0);
        ModInt<MOD> res(1), now(*this);
        while (t) {
            if (t & 1) res *= now;
            now *= now;
            t >>= 1;
        }
        return res;
    }
    ModInt<MOD> inv() const {
        return pow(MOD - 2);
    }
    ModInt<MOD> &operator/= (const ModInt<MOD> &x) {
        return *this *= x.pow(MOD - 2);
    }
    ModInt<MOD> operator/ (const ModInt<MOD> &x) const {
        return ModInt(*this) /= x;
    }
    friend std::istream &operator>> (std::istream &is, ModInt<MOD> &x) {
        long long a;
        is >> a;
        x = ModInt<MOD>(a);
        return is;
    }
    friend std::ostream &operator<< (std::ostream &os, const ModInt<MOD> &x) {
        os << x.val;
        return os;
    }
};

constexpr int mod = 998244353;
using mint = ModInt<mod>;

// Lazy Segment Tree
template <typename Operator>
class LazySegmentTree {
    Operator OP;
    using NodeType = decltype(OP.NodeE);
    using FuncType = decltype(OP.FuncE);
    int length, height, n_;
    std::vector<NodeType> node;
    std::vector<FuncType> lazy;
    std::vector<int> width;
    void eval(int n) {
        node[n] = OP.NodeFunc(node[n], lazy[n], width[n]);
        if (n < length) {
            lazy[(n << 1) | 0] = OP.MergeFunc(lazy[(n << 1) | 0], lazy[n]);
            lazy[(n << 1) | 1] = OP.MergeFunc(lazy[(n << 1) | 1], lazy[n]);
        }
        lazy[n] = OP.FuncE;
    }
public:
    LazySegmentTree(int n) : n_(n) {
        length = 1;
        height = 0;
        while (length < n) {
            length <<= 1;
            ++height;
        }
        node.resize(length << 1, OP.NodeE);
        lazy.resize(length << 1, OP.FuncE);
        width.resize(length << 1, 1);
        for (int i = length - 1; i > 0; --i) width[i] = width[i << 1] << 1;
    }
    LazySegmentTree(std::vector<NodeType> &vec) : n_((int)vec.size()) {
        length = 1;
        height = 0;
        while (length < (int)vec.size()) {
            length <<= 1;
            ++height;
        }
        node.resize(length << 1, OP.NodeE);
        for (int i = 0; i < (int)vec.size(); ++i) node[i + length] = vec[i];
        for (int i = length - 1; i > 0; --i) node[i] = OP.MergeNode(node[(i << 1) | 0], node[(i << 1) | 1]);
        lazy.resize(length << 1, OP.FuncE);
        width.resize(length << 1, 1);
        for (int i = length - 1; i > 0; --i) width[i] = width[i << 1] << 1;
    }
    void update(int a, int b, FuncType x) {
        assert(a >= 0 && a <= n_ && b >= 0 && b <= n_ && a <= b);
        int l = a + length, r = b + length - 1;
        for (int i = height; i > 0; --i) {
            eval(l >> i);
            eval(r >> i);
        }
        ++r;
        while (r > l) {
            if (l & 1) {
                lazy[l] = OP.MergeFunc(lazy[l], x);
                eval(l);
                ++l;
            }
            if (r & 1) {
                --r;
                lazy[r] = OP.MergeFunc(lazy[r], x);
                eval(r);
            }
            l >>= 1; r >>= 1;
        }
        l = a + length; r = b + length - 1;
        while (l >>= 1) node[l] = OP.MergeNode(OP.NodeFunc(node[(l << 1) | 0], lazy[(l << 1) | 0], width[(l << 1) | 0]), OP.NodeFunc(node[(l << 1) | 1], lazy[(l << 1) | 1], width[(l << 1) | 1]));
        while (r >>= 1) node[r] = OP.MergeNode(OP.NodeFunc(node[(r << 1) | 0], lazy[(r << 1) | 0], width[(r << 1) | 0]), OP.NodeFunc(node[(r << 1) | 1], lazy[(r << 1) | 1], width[(r << 1) | 1]));
    }
    NodeType get(int a, int b) {
        assert(a >= 0 && a <= n_ && b >= 0 && b <= n_ && a <= b);
        int l = a + length, r = b + length - 1;
        for (int i = height; i >= 0; --i) {
            eval(l >> i);
            eval(r >> i);
        }
        ++r;
        NodeType vl = OP.NodeE, vr = OP.NodeE;
        while (l < r) {
            if (l & 1) {
                vl = OP.MergeNode(vl, OP.NodeFunc(node[l], lazy[l], width[l]));
                ++l;
            }
            if (r & 1) {
                --r;
                vr = OP.MergeNode(OP.NodeFunc(node[r], lazy[r], width[r]), vr);
            }
            l >>= 1; r >>= 1;
        }
        return OP.MergeNode(vl, vr);
    }
};

vector<mint> ten, tsum;

struct N {
    mint v;
    int length;
};

struct RSQ {
    using NodeType = N;
    using FuncType = int;
    NodeType NodeE = N{mint(0), 0};
    FuncType FuncE = -1;
    NodeType MergeNode(NodeType x, NodeType y) {
        return N{x.v * ten[y.length] + y.v, x.length + y.length};
    }
    FuncType MergeFunc(FuncType x, FuncType y) {
        if (y == FuncE) return x;
        return y;
    }
    NodeType NodeFunc(NodeType x, FuncType y, int len) {
        if (y == FuncE) return x;
        return {mint(y) * tsum[len], len};
    }
};


// Main
int main() {
    int n, q;
    cin >> n >> q;
    ten.resize(n, mint(1));
    rep(i, n - 1) ten[i + 1] = ten[i] * mint(10);
    tsum.resize(n + 1, mint(0));
    rep(i, n) tsum[i + 1] = tsum[i] + ten[i];
    vector<N> aaaaa(n);
    rep(i, n) aaaaa[i] = N{mint(1), 1};
    LazySegmentTree<RSQ> st(aaaaa);
    rep(i, q) {
        int l, r, d;
        cin >> l >> r >> d;
        --l;
        st.update(l, r, d);
        cout << st.get(0, n).v << "\n";
    }

}

Measured memory_bytes: 21720