There is a simple undirected graph with $N$ vertices numbered $1$ through $N$ and $M$ edges numbered $1$ through $M$. Edge $i$ connects vertex $u_i$ and vertex $v_i$.
Every vertex is painted either red or blue. The color of vertex $i$ is represented by $C_i$; vertex $i$ is painted red if $C_i$ is $0$ and blue if $C_i$ is $1$.
Now, Takahashi is on vertex $1$ and Aoki is on vertex $N$.
They may repeat the following move zero or more times.
* Each of the two simultaneously moves to a vertex adjacent to the current vertex.
Here, the vertices that Takahashi and Aoki move to must have different colors.
By repeating the move above, can Takahashi and Aoki simultaneously end up on vertices $N$ and $1$, respectively?
If it is possible, find the minimum number of moves required. If it is impossible, print `-1`.
You are given $T$ at the beginning of the input. Solve the problem for $T$ test cases.
## Constraints
* $1 \leq T \leq 1000$
* $2 \leq N \leq 2000$
* $1 \leq M \leq \min(\frac{N(N-1)}{2}, 2000)$
* $C_i \in \lbrace 0, 1 \rbrace$
* $1 \leq u_i, v_i \leq N$
* The graph given in the input is simple.
* All values in the input are integers.
* The sum of $N$ over all test cases does not exceed $2000$.
* The sum of $M$ over all test cases does not exceed $2000$.
## Input
The input is given from Standard Input in the following format, where $\text{test}_i$ denotes the $i$\-th test case:
$T$
$\text{test}_1$
$\text{test}_2$
$\vdots$
$\text{test}_T$
Each test case is given in the following format:
$N$ $M$
$C_1$ $C_2$ $\dots$ $C_N$
$u_1$ $v_1$
$u_2$ $v_2$
$\vdots$
$u_M$ $v_M$
[samples]