Buggy python submission (verdict: Time Limit Exceeded):
mod = 998244353
INF = float("inf")


class lazySegTree(object):
	def __init__(self, N):
		self.N = N
		self.LV = (N-1).bit_length()
		self.N0 = 2**self.LV
		self.data = [0]*(2*self.N0) #桁の値を管理(lazy*size)
		self.lazy = [0]*(2*self.N0) #桁の文字を管理
		self.size = [1]*(2*self.N0) #桁の和を管理(10^n)(更新しない)
		for i in range(self.N):
			self.size[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.size[i] = (self.size[2*i+1] + self.size[2*i+2])%mod
	# 遅延セグ木の初期化
	def initialize(self):
		for i in range(self.N):
			self.data[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.data[i] = (self.data[2*i+1] + self.data[2*i+2])%mod

  # 遅延伝播を行うindexを生成
	def gindex(self, l, r):
		L = l + self.N0
		L >>= 1
		R = r + self.N0
		R >>= 1
		if l & 1:
			lc = 0
		else:
			lc = (L & -L).bit_length()
		if r & 1:
			rc = 0
		else:
			rc = (R & -R).bit_length()
		for i in range(self.LV):
			if rc <= i:
				yield R
			if L < R and lc <= i:
				yield L
			L >>= 1 
			R >>= 1

	# 遅延伝搬処理
	def propagates(self, *ids):
		for i in reversed(ids):
			v = self.lazy[i - 1]
			if not v:
				continue
			self.lazy[2*i-1] = v
			self.lazy[2*i] = v
			self.data[2*i-1] = v * self.size[2*i-1]
			self.data[2*i] = v * self.size[2*i]
			self.lazy[i-1] = 0

	def update(self, l, r, x):
		*ids, = self.gindex(l, r+1)
		self.propagates(*ids)
		L = self.N0 + l
		R = self.N0 + r + 1
		while L < R:
			if R & 1:
				R -= 1
				self.lazy[R-1] = x #桁の文字を更新
				self.data[R-1] = x * self.size[R-1] #桁の値を更新
			if L & 1:
				self.lazy[L-1] = x
				self.data[L-1] = x * self.size[L-1]
				L += 1
			L >>= 1
			R >>= 1
		for i in ids:
			self.data[i-1] = (self.data[2*i-1] + self.data[2*i])%mod

	# 区間[l, r]内のdataの和を求める
	def query(self, l, r):
		self.propagates(*self.gindex(l, r+1))
		L = self.N0 + l
		R = self.N0 + r + 1
		s = 0
		while L < R:
			if R & 1:
				R -= 1
				s = (s + self.data[R-1])%mod
			if L & 1:
				s = (s + self.data[L-1])%mod
				L += 1
			L >>= 1
			R >>= 1
		return s

N, Q = map(int, input().split())
lSeg = lazySegTree(N)
lSeg.initialize()

for i in range(Q):
	L, R, D = map(int, input().split())
	L -= 1
	R -= 1
	lSeg.update(L, R, D)
	ans = lSeg.query(0, N-1)
	ans %= mod
	print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.buffer.readline
mod = 998244353
INF = float("inf")


class lazySegTree(object):
	def __init__(self, N):
		self.N = N
		self.LV = (N-1).bit_length()
		self.N0 = 2**self.LV
		self.data = [0]*(2*self.N0) #桁の値を管理(lazy*size)
		self.lazy = [0]*(2*self.N0) #桁の文字を管理
		self.size = [1]*(2*self.N0) #桁の和を管理(10^n)(更新しない)
		for i in range(self.N):
			self.size[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.size[i] = (self.size[2*i+1] + self.size[2*i+2])%mod
	# 遅延セグ木の初期化
	def initialize(self):
		for i in range(self.N):
			self.data[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.data[i] = (self.data[2*i+1] + self.data[2*i+2])%mod

  # 遅延伝播を行うindexを生成
	def gindex(self, l, r):
		L = l + self.N0
		L >>= 1
		R = r + self.N0
		R >>= 1
		if l & 1:
			lc = 0
		else:
			lc = (L & -L).bit_length()
		if r & 1:
			rc = 0
		else:
			rc = (R & -R).bit_length()
		for i in range(self.LV):
			if rc <= i:
				yield R
			if L < R and lc <= i:
				yield L
			L >>= 1 
			R >>= 1

	# 遅延伝搬処理
	def propagates(self, *ids):
		for i in reversed(ids):
			v = self.lazy[i - 1]
			if not v:
				continue
			self.lazy[2*i-1] = v
			self.lazy[2*i] = v
			self.data[2*i-1] = v * self.size[2*i-1]
			self.data[2*i] = v * self.size[2*i]
			self.lazy[i-1] = 0

	def update(self, l, r, x):
		*ids, = self.gindex(l, r+1)
		self.propagates(*ids)
		L = self.N0 + l
		R = self.N0 + r + 1
		while L < R:
			if R & 1:
				R -= 1
				self.lazy[R-1] = x #桁の文字を更新
				self.data[R-1] = x * self.size[R-1] #桁の値を更新
			if L & 1:
				self.lazy[L-1] = x
				self.data[L-1] = x * self.size[L-1]
				L += 1
			L >>= 1
			R >>= 1
		for i in ids:
			self.data[i-1] = (self.data[2*i-1] + self.data[2*i])%mod

	# 区間[l, r]内のdataの和を求める
	def query(self, l, r):
		self.propagates(*self.gindex(l, r+1))
		L = self.N0 + l
		R = self.N0 + r + 1
		s = 0
		while L < R:
			if R & 1:
				R -= 1
				s = (s + self.data[R-1])%mod
			if L & 1:
				s = (s + self.data[L-1])%mod
				L += 1
			L >>= 1
			R >>= 1
		return s

N, Q = map(int, input().split())
lSeg = lazySegTree(N)
lSeg.initialize()

for i in range(Q):
	L, R, D = map(int, input().split())
	L -= 1
	R -= 1
	lSeg.update(L, R, D)
	ans = lSeg.query(0, N-1)
	ans %= mod
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
mod = 998244353
INF = float("inf")


class lazySegTree(object):
	def __init__(self, N):
		self.N = N
		self.LV = (N-1).bit_length()
		self.N0 = 2**self.LV
		self.data = [0]*(2*self.N0) #桁の値を管理(lazy*size)
		self.lazy = [0]*(2*self.N0) #桁の文字を管理
		self.size = [1]*(2*self.N0) #桁の和を管理(10^n)(更新しない)
		for i in range(self.N):
			self.size[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.size[i] = (self.size[2*i+1] + self.size[2*i+2])%mod
	# 遅延セグ木の初期化
	def initialize(self):
		for i in range(self.N):
			self.data[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.data[i] = (self.data[2*i+1] + self.data[2*i+2])%mod

  # 遅延伝播を行うindexを生成
	def gindex(self, l, r):
		L = l + self.N0
		L >>= 1
		R = r + self.N0
		R >>= 1
		if l & 1:
			lc = 0
		else:
			lc = (L & -L).bit_length()
		if r & 1:
			rc = 0
		else:
			rc = (R & -R).bit_length()
		for i in range(self.LV):
			if rc <= i:
				yield R
			if L < R and lc <= i:
				yield L
			L >>= 1 
			R >>= 1

	# 遅延伝搬処理
	def propagates(self, *ids):
		for i in reversed(ids):
			v = self.lazy[i - 1]
			if not v:
				continue
			self.lazy[2*i-1] = v
			self.lazy[2*i] = v
			self.data[2*i-1] = v * self.size[2*i-1]
			self.data[2*i] = v * self.size[2*i]
			self.lazy[i-1] = 0

	def update(self, l, r, x):
		*ids, = self.gindex(l, r+1)
		self.propagates(*ids)
		L = self.N0 + l
		R = self.N0 + r + 1
		while L < R:
			if R & 1:
				R -= 1
				self.lazy[R-1] = x #桁の文字を更新
				self.data[R-1] = x * self.size[R-1] #桁の値を更新
			if L & 1:
				self.lazy[L-1] = x
				self.data[L-1] = x * self.size[L-1]
				L += 1
			L >>= 1
			R >>= 1
		for i in ids:
			self.data[i-1] = (self.data[2*i-1] + self.data[2*i])%mod

	# 区間[l, r]内のdataの和を求める
	def query(self, l, r):
		self.propagates(*self.gindex(l, r+1))
		L = self.N0 + l
		R = self.N0 + r + 1
		s = 0
		while L < R:
			if R & 1:
				R -= 1
				s = (s + self.data[R-1])%mod
			if L & 1:
				s = (s + self.data[L-1])%mod
				L += 1
			L >>= 1
			R >>= 1
			s %= mod
		return s

N, Q = map(int, input().split())
lSeg = lazySegTree(N)
lSeg.initialize()

for i in range(Q):
  L, R, D = map(int, input().split())
  L -= 1
  R -= 1
  lSeg.update(L, R, D)
  ans = lSeg.query(0, N-1)
  print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.buffer.readline
mod = 998244353
INF = float("inf")


class lazySegTree(object):
	def __init__(self, N):
		self.N = N
		self.LV = (N-1).bit_length()
		self.N0 = 2**self.LV
		self.data = [0]*(2*self.N0) #桁の値を管理(lazy*size)
		self.lazy = [0]*(2*self.N0) #桁の文字を管理
		self.size = [1]*(2*self.N0) #桁の和を管理(10^n)(更新しない)
		for i in range(self.N):
			self.size[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.size[i] = (self.size[2*i+1] + self.size[2*i+2])%mod
	# 遅延セグ木の初期化
	def initialize(self):
		for i in range(self.N):
			self.data[self.N0-1+i] = pow(10, self.N-i-1, mod)
		for i in range(self.N0-2, -1, -1):
			self.data[i] = (self.data[2*i+1] + self.data[2*i+2])%mod

  # 遅延伝播を行うindexを生成
	def gindex(self, l, r):
		L = l + self.N0
		L >>= 1
		R = r + self.N0
		R >>= 1
		if l & 1:
			lc = 0
		else:
			lc = (L & -L).bit_length()
		if r & 1:
			rc = 0
		else:
			rc = (R & -R).bit_length()
		for i in range(self.LV):
			if rc <= i:
				yield R
			if L < R and lc <= i:
				yield L
			L >>= 1 
			R >>= 1

	# 遅延伝搬処理
	def propagates(self, *ids):
		for i in reversed(ids):
			v = self.lazy[i - 1]
			if not v:
				continue
			self.lazy[2*i-1] = v
			self.lazy[2*i] = v
			self.data[2*i-1] = v * self.size[2*i-1]
			self.data[2*i] = v * self.size[2*i]
			self.lazy[i-1] = 0

	def update(self, l, r, x):
		*ids, = self.gindex(l, r+1)
		self.propagates(*ids)
		L = self.N0 + l
		R = self.N0 + r + 1
		while L < R:
			if R & 1:
				R -= 1
				self.lazy[R-1] = x #桁の文字を更新
				self.data[R-1] = x * self.size[R-1] #桁の値を更新
			if L & 1:
				self.lazy[L-1] = x
				self.data[L-1] = x * self.size[L-1]
				L += 1
			L >>= 1
			R >>= 1
		for i in ids:
			self.data[i-1] = (self.data[2*i-1] + self.data[2*i])%mod

	# 区間[l, r]内のdataの和を求める
	def query(self, l, r):
		self.propagates(*self.gindex(l, r+1))
		L = self.N0 + l
		R = self.N0 + r + 1
		s = 0
		while L < R:
			if R & 1:
				R -= 1
				s = (s + self.data[R-1])%mod
			if L & 1:
				s = (s + self.data[L-1])%mod
				L += 1
			L >>= 1
			R >>= 1
		return s

N, Q = map(int, input().split())
lSeg = lazySegTree(N)
lSeg.initialize()

for i in range(Q):
	L, R, D = map(int, input().split())
	L -= 1
	R -= 1
	lSeg.update(L, R, D)
	ans = lSeg.query(0, N-1)
	ans %= mod
	print(ans)