Bessie and her friend Elsie decide to have a meeting. However, after Farmer John decorated his

fences they were separated into different blocks. John's farm are divided into $n$ blocks labelled from $1$ to $n$.

Bessie lives in the first block while Elsie lives in the $n$-th one. They have a map of the farm

which shows that it takes they $t_i$ minutes to travel from a block in $E_i$ to another block

in $E_i$ where $E_i~(1\le i\le m)$ is a set of blocks. They want to know how soon they can meet each other

and which block should be chosen to have the meeting.

fences they were separated into different blocks. John's farm are divided into $n$ blocks labelled from $1$ to $n$.

Bessie lives in the first block while Elsie lives in the $n$-th one. They have a map of the farm

which shows that it takes they $t_i$ minutes to travel from a block in $E_i$ to another block

in $E_i$ where $E_i~(1\le i\le m)$ is a set of blocks. They want to know how soon they can meet each other

and which block should be chosen to have the meeting.

The first line contains an integer $T~(1\le T\le 6)$, the number of test cases. Then $T$ test cases

follow.

The first line of input contains $n$ and $m$. $2 \leq n \leq 10^5$. The following $m$ lines describe the sets $E_i~(1\le i\le m)$. Each line will contain two integers $t_i(1 \leq t_i \leq 10^9)$ and $S_i~(S_i>0)$ firstly. Then $S_i$ integer follows which are the labels of blocks in $E_i$. It is guaranteed that $\sum_{i=1}^m{S_i} \leq 10^6$.

follow.

The first line of input contains $n$ and $m$. $2 \leq n \leq 10^5$. The following $m$ lines describe the sets $E_i~(1\le i\le m)$. Each line will contain two integers $t_i(1 \leq t_i \leq 10^9)$ and $S_i~(S_i>0)$ firstly. Then $S_i$ integer follows which are the labels of blocks in $E_i$. It is guaranteed that $\sum_{i=1}^m{S_i} \leq 10^6$.

For each test case, if they cannot have the meeting, then output "Evil John" (without quotes) in one line.

Otherwise, output two lines. The first line contains an integer, the time it takes for they to meet.

The second line contains the numbers of blocks where they meet. If there are multiple

optional blocks, output all of them in ascending order.

Otherwise, output two lines. The first line contains an integer, the time it takes for they to meet.

The second line contains the numbers of blocks where they meet. If there are multiple

optional blocks, output all of them in ascending order.

Case #1: 3 3 4 Case #2: Evil JohnIn the first case, it will take Bessie 1 minute travelling to the 3rd block, and it will take Elsie 3 minutes travelling to the 3rd block. It will take Bessie 3 minutes travelling to the 4th block, and it will take Elsie 3 minutes travelling to the 4th block. In the second case, it is impossible for them to meet.Hint

提交代码