#3297. Pku2931 Procrastination

Pku2931 Procrastination

Background

Special for beginners, ^_^

Description

Format

Input

The first line of the input contains an integer, the number of test cases. A test case includes one line with Test N, where N is the current test case number followed by eight lines, specifying the two partial configurations C1 and C2 in this order. Each configuration is specified by four lines. The first line of the partial configuration contains three numbers: n1, n2, n3 denoting the heights of the three towers of the partial configuration (0 <= n1, n2, n3 <= 50). The second line contains n1 letters (B or W) separated by spaces describing the first tower. The third line contains n2 letters separated by spaces describing the second tower. The fourth line contains n3 letters separated by spaces describing the third tower. A letter W denotes a white cube and the letter B denotes a black cube. Each tower is described in the bottom-to-top order.

Output

For each test case, print on a separate line the test case number and Yes if C1 is at least as favorable for white as the partial configuration C2, and No otherwise.

Samples

2
Test 1
3 3 1
W B B
W B W
B
3 3 3
B W W
B W W
W B B
Test 2
3 3 2
W B B
W B W
B B
3 3 3
B W W
B W W
W B B
Test 1: Yes
Test 2: No

Limitation

1s, 1024KiB for each test case.