The first line of input contains the number of test cases T. The descriptions of the test cases
follow:
Each test case starts with one line containing an integer n (1《 n≤ 105) which is the length of
the description of a sequence. Each of the following n lines consists of an integer k (1≤ k < 10^9)
and one of the characters W or B, meaning that k bricks of the given color follow next in the
sequence. It is guaranteed that the total length of the brick sequence does not exceed 10^9.