Today, Esmaan decided to prove to the world that he is not ordinary. He went to take the exam to become a data structures master. But the first question of the exam stumped him. Help him solve the problem:
You have a sequence of integers $a_1, a_2, \ldots, a_n$. In addition, you have three empty sequences: $A$, $B$, and $C$.
You need to perform $q$ queries of the following type:
After each query, output $S$ modulo $998\,244\,353$.
The first line contains two integers $n$ and $q$ ($1 \le n, q \le 10^5$): the number of elements in the sequence and the number of queries.
The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^5$): the elements of the sequence.
Then follow $q$ lines, each containing a query in the format "$X$ $\mathit{val}$" ($X \in \{$A, B, C$\}$, $1 \le \mathit{val} \le n$).
After each query, output a line with a single integer: the current value of $S$ modulo $998\,244\,353$.