##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
4
4 4 1 2 0 2 3 1 3 4 0 4 1 1
3 2 1 2 0 2 3 0
3 3 1 2 0 1 3 1 2 3 0
5 5 1 2 0 2 3 0 1 3 1 1 4 0 4 5 1
-1
1
2
3

You are given an undirected connected graph with vertices and edges. Each edge is colored either blue or red. The graph has no self-loops and no multiple edges.
A color sequence of length is a string where each ( means blue, means red).
A color sequence is called reachable if there exists a walk that:
For each test case, find the minimum integer such that there exists at least one non-reachable color sequence of length . If every color sequence of every length is reachable, output .
, cycle with edges
A cycle alternating blue-red-blue-red. From any vertex, we can reach any color sequence. Answer: -1.
, path with edges
Only blue edges exist. The sequence "R" is unreachable. Answer: 1.