Intersection
It is known that a bypass highway is being constructed in Krasnoyarsk. This highway is not a ring road, meaning it has distinct western and eastern ends (though this might change in the future). The most intriguing engineering features of this road are the bridges. Clearly, a reinforced concrete bridge is too costly for a section with only one car per day, while a wooden bridge cannot accommodate a highway with a dozen cars per minute. Therefore, to design bridges appropriately, it's essential to know how many cars will pass over them.
The road will primarily use "cloverleaf" interchanges, and a diagram of such an interchange is shown in the figure. According to this scheme, a car turning right does not go over the bridge, a car turning left (which in this interchange turns 270 degrees to the right and crosses its path on the second level) always goes over the bridge, and a car going straight may or may not go over the bridge, depending on the direction of travel.
The flow of cars on roads intersecting the bypass road has been studied. The task is to calculate the flow of cars that will travel over the bridges of the bypass road. It should be noted that for some intersections, the bypass road runs on the ground, and the bridge contains the crossroad—such bridges should not be counted. Although the road is two-way, each test examines only one direction of the bypass road (for example, from west to east).
Input
The first line of input contains the number of tests. The first line of each test contains the number N ≤ 100—the number of intersections, listed from west to east. The next N lines provide information about the type of crossing, followed by the flow of the crossroad. The type of crossing is indicated by a Latin letter: L, meaning the bypass road runs on the ground and the crossroad runs over the bridge, or B, meaning the crossroad runs on the ground and the bypass runs over the bridge. Then 2 numbers are given, indicating the number of cars that left the bypass road, the first number for those turning left, the second for those turning right. Following that, 2 numbers are given, indicating the number of cars that entered the bypass road, the first number for those turning left, the second for those turning right. The number of cars on any of the cross roads does not exceed 10^9.
The input data is guaranteed to be correct (initially, there are no cars on the highway, and the same number of cars leave the highway as enter it, with the eastern intersection point located after the western intersection).
Output
For each test, the output should contain one line with N numbers—the car flows on the bridge of the bypass road. If the bypass road runs on the ground and the bridge is above it, output -1.