This problem contains multiple test cases.
The first line contains an integer $T(1\le T\le 20)$, the number of test cases.
Each test case starts with a line of three integers $n,m,k(1\le n,m,k\le 200)$.
Then $n$ lines follow. The $i$th line contains $m$ pairs of $f_{ij},c_{ij}(1\le f_{ij}\le 10^4,c_{ij}\in \{\texttt{Y},\texttt{N}\})$, meaning if the brick located at the $i$th line and $j$th column is shot, player will get $f_{ij}$ points and will(Y) or won't(N) get a reward bullet after that. Initally, the bricks at the $n$th line is exposed outside, so you need to shoot them as a start.