Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains a single integer $n$, denoting the number of cells that initially contain at least one chip ($2 \le n \le 2 \cdot 10^5$).

The $i$-th of the following $n$ lines contains two integers $x_i$, $m_i$, and a character $c_i$, denoting the coordinate of the $i$-th non-empty cell from the left, the number of chips in it, and the color of these chips ($1 \le x_1 < x_2 < \cdots < x_n \le 10^6$; $1 \le m_i \le 10^6$; $c_i \in \{\mathtt{R}, \mathtt{B}\}$). There is at least one chip of each color on the tape.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.