output_description: Print Q lines. In the i-th line print the value of S after the i-th query,
  modulo 998,244,353.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N Q
      L_1 R_1 D_1
      :
      L_Q R_Q D_Q
attempt: # class化。
  import sys
  
  input = sys.stdin.buffer.readline
  
  mod = 998244353
  
  max_n = 2 * pow(10, 5) + 10
  pow_list = [1] * max_n
  cum_pow = [0] * max_n
  cum_pow[0] = 1
  for i in range(1, max_n):
      pow_list[i] = pow_list[i - 1] * 10
      pow_list[i] %= mod
      cum_pow[i] += cum_pow[i - 1] + pow_list[i]
      cum_pow[i] %= mod
  cum_pow = [0] + cum_pow
  
  
  class LazySegmentTree:
      # funcはseg同士、calcはpoint計算
      def __init__(self, n, ele, lazy_ele, mod=mod):
          self.n = n
          self.ele = ele
          self.lazy_ele = lazy_ele
          self.num = 2 ** ((self.n - 1).bit_length())
          self.SEG = [self.ele] * (2 * self.num)
          self.LAZY = [self.lazy_ele] * (2 * self.num)
          self.node = [1] * (2 * self.num)
          for i in reversed(range(1, self.num)):
              self.node[i] = self.node[2 * i] + self.node[2 * i + 1]
  
      # SEG同士の計算
      def func(self, a, b, b_idx):
          # print(a, b, a_idx, b_idx)
          node_num = self.node[b_idx]
          return (a * pow_list[node_num] + b) % mod
  
      # LAZYをSEGに作用
      def calc(self, idx):
          if self.LAZY[idx] == -1:
              return self.SEG[idx]
          node_num = self.node[idx]
          res = (self.LAZY[idx] * cum_pow[node_num]) % mod
          return res
  
      # LAZY同士の作用の蓄積
      def lazy_func(self, a, b):
          return b
  
      # 配列で初期化
      def initialize(self, A):
          for i, val in enumerate(A):
              i += self.num
              self.SEG[i] = val
          for i in reversed(range(1, self.num)):
              self.SEG[i] = self.func(self.SEG[2 * i], self.SEG[2 * i + 1], 2 * i)
  
      # LAZYの値を1つ下に伝播して初期化
      def propagate_point(self, idx):
          self.SEG[idx] = self.calc(idx)
          # print(idx)
          if self.LAZY[idx] >= 0:
              self.LAZY[2 * idx] = self.lazy_func(self.LAZY[2 * idx], self.LAZY[idx])
              self.LAZY[2 * idx + 1] = self.lazy_func(
                  self.LAZY[2 * idx + 1], self.LAZY[idx]
              )
              self.LAZY[idx] = lazy_ele
  
      # idx=1からidxの直上まで、伝播を行う
      def propagate_above(self, idx):
          height = idx.bit_length() - 1
          # print(idx, height)
          for h in reversed(range(1, height + 1)):
              self.propagate_point(idx >> h)
  
      # そのidxの直上の値を計算
      def recalc_above(self, idx):
          # print("ra", idx)
          while idx > 1:
              idx //= 2
              self.SEG[idx] = self.func(
                  self.calc(2 * idx),
                  self.calc(2 * idx + 1),
                  2 * idx,
              )
  
      # 1点更新
      def update_point(self, idx):
          idx += self.num
          while idx > 0:
              idx //= 2
              self.SEG[idx] = self.func(
                  self.calc(self.SEG[2 * idx]),
                  self.calc(self.SEG[2 * idx + 1]),
                  2 * idx,
              )
  
      # 範囲更新
      def update_range(self, left, right, mono):
          left += self.num
          right += self.num
          left_temp = left // (left & -left)
          right_temp = right // (right & -right) - 1
          self.propagate_above(left_temp)
          self.propagate_above(right_temp)
          while left < right:
              if left & 1:
                  self.LAZY[left] = self.lazy_func(self.LAZY[left], mono)
                  left += 1
              if right & 1:
                  right -= 1
                  self.LAZY[right] = self.lazy_func(self.LAZY[right], mono)
              left //= 2
              right //= 2
          self.recalc_above(left_temp)
          self.recalc_above(right_temp)
  
      # 範囲取得
      def get_range(self, left, right):
          left += self.num
          right += self.num
          self.propagate_above(left // (left & -left))
          self.propagate_above(right // (right & -right) - 1)
          res_left = self.ele
          res_right = self.ele
          while left < right:
              if left & 1:
                  res_left = self.func(res_left, self.calc(left), left)
                  left += 1
              if right & 1:
                  right -= 1
                  res_right = self.func(self.calc(right), res_right, right)
              left //= 2
              right //= 2
          return self.func(res_right, res_left, self.n // 2) % mod
  
      # def get_point(self, idx):
      #     a,b=self.LAZY[idx]>>32, self.LAZY[idx]&(1<<32-1)
      #     return a*self.SEG[idx]+b*self.node[idx]
  
  
  ele = 0
  lazy_ele = -1
  n, q = map(int, input().split())
  A = [1 for _ in range(n)]
  LST = LazySegmentTree(n, ele, lazy_ele)
  LST.initialize(A)
  
  
  for _ in range(q):
      l, r, d = map(int, input().split())
      l -= 1
  
      LST.update_range(l, r, d)
  
      print(LST.get_range(0, n) % mod)
  
problem_description: Statement
  
  You have a string S of length N. Initially, all characters in S are `1`s.
  
  You will perform queries Q times. In the i-th query, you are given two
  integers L_i, R_i and a character D_i (which is a digit). Then, you must
  replace all characters from the L_i-th to the R_i-th (inclusive) with D_i.
  
  After each query, read the string S as a decimal integer, and print its value
  modulo 998,244,353.
samples: [{"input": "8 5\n    3 6 2\n    1 4 7\n    3 8 3\n    2 2 2\n    4 5 1", "output": "11222211\n    77772211\n    77333333\n    72333333\n    72311333\n    \n\n* * *"}, {"input": "200000 1\n    123 456 7", "output": "641437905\n    \n\nDon't forget to take the modulo."}]