At Punny Bunny Middle School (PBMS), teachers assign homework in a peculiar and unfair way. Suppose there are $N$ rows and $M$ columns of students seated in a classroom. The teacher will assign $K$ pieces of homework, but each piece of homework is assigned to one particular row or column of students only.

Suppose the classroom has $3 \times 4$ seats. The teacher assigns one piece of homework for each student on row $3$, and another piece of homework for each student on column $2$:

$$ \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 1 & 2 & 1 & 1 \end{bmatrix} $$

Then one student would have to complete $2$ pieces of homework.

As the class monitor, your job is to count how many pieces of homework each student has to hand in.

Input

The first line of input consists of three integers $N, M$ and $K$.
Each of the next $K$ lines of input are of the format R X or C X, meaning the teacher assigns one piece of homework for each student on row or column $X$.

Output

Output how many pieces of homework each student has to complete, according to the layout of the classroom.

Constraints

$1 \le N, M, K \le 500$

Sample Test Cases

Input Output
3 4 2
R 3
C 2
0 1 0 0
0 1 0 0
1 2 1 1
2 2 4
R 1
C 1
R 2
C 2
2 2
2 2
Click to copy.

Scoring: Per Subtask
Authored by s16f22
Appeared in 2023 Mini Contest 1