시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 64 MB 1 1 1 100.000%

문제

Professor Zhang is trying to solve one of Karp's 21 NP-complete problems: the Graph Coloring Problem.

At first, he generates an undirected graph with $n$ vertices and $m$ edges. Then, he colors all the vertices black or white. Finally, he wants to use the following operation to make the vertices correctly colored: choose two adjacent vertices and swap their colors. The vertices are correctly colored if and only if no two adjacent vertices share the same color.

Professor Zhang wants to know the minimum number of operations needed.

입력

There are multiple test cases. The first line of input contains an integer $T$ indicating the number of test cases. For each test case:

The first line contains two integers $n$ and $m$ ($2 \le n \le 500$, $1 \le m \le \frac{n \cdot (n - 1)}{2}$): the number of vertices and the number of edges. The second line contains a binary string of length $n$. The $i$-th vertex is colored white if the $i$-th character is '0', or black otherwise.

Each of the next $m$ lines contains two integers $x_i$ and $y_i$ ($1 \le x_i, y_i \le n$, $x_i \ne y_i$) denoting an undirected edge.

There are at most $200$ test cases, and the total size of the input is no more than $1.5$ mebibytes.

출력

For each test case, output an integer $s$ denoting the minimum number of operations in the first line. Each of the next $s$ lines must contain two integers $u_i$ and $v_i$ ($1 \le u_i, v_i \le n$, $u_i \ne v_i$) denoting the $i$-th operation.

If there is no such solution, just output "$-1$" on a single line.

예제 입력 1

3
4 4
0011
1 2
2 3
3 4
4 1
2 1
00
1 2
6 7
011001
1 4
1 5
4 2
5 2
5 3
2 6
6 3


예제 출력 1

1
4 1
-1
2
2 4
3 5