Power Station of Art

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

As a modern art lover, Nocriz loves going to the Power Station of Art.

Currently, art pieces of a modern genre of art called "red-black graphs" are exhibited in the Power Station of Art. Every red-black graph art piece is an undirected labeled graph with numbers and colors associated with each vertex. Each vertex is either red or black.

It is possible to modify a graph in the following way: choose an edge and swap the numbers written on the corresponding vertices. In addition, if the colors of the two vertices are the same, the colors of both vertices are changed (from red to black or from black to red). Otherwise, the colors of the two vertices remain unchanged.

Now, Nocriz is studying two art pieces. The graphs are the same but the numbers and colors may be different. Is it possible to make some (possibly zero) modifications to the art pieces to make them be the same?

입력

The first line contains an integer TT (1T31041 \le T \le 3 \cdot 10^4), the number of test cases. Then TT test cases follow.

The first line of each test case contains two integers nn and mm (1n1061 \le n \le 10^6, 0m1060 \le m \le 10^6), the number of vertices and edges.

Then mm lines follow, each of them contains two integers u_iu\_i and v_iv\_i (1u_i,v_in1 \leq u\_i, v\_i \leq n, u_iv_iu\_i \ne v\_i) representing an edge. It is guaranteed that there are no multiple edges in the input, and the graph may be unconnected.

Then numbers and colors of the two graphs follow. For each graph:

The first line contains nn integers, the ii-th integer a_ia\_i (0a_i1060 \le a\_i \le 10^6) representing the number written on the ii-th vertex of the graph.

The second line contains nn characters. If the ii-th character is 'R', the ii-th vertex is red. If the ii-th character is 'B', the ii-th vertex is black.

It is guaranteed that n106\sum n \le 10^6 and m106\sum m \le 10^6.

출력

For each test case, output a single line containing "YES" if it is possible to make some (possibly zero) modifications to the art pieces to make them be the same, or "NO" otherwise.