{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere is a network of $N$ people. Each person has an ID from 0 to $N-1$. In this network, some people are friends with each other.\nA person can ask a favor of another person directly if they are friends.\u003c/p\u003e\n\n\u003cp\u003e If a person wants to ask a favor of someone who is not his friend, he needs to use intermediate people. For example, if $B$ is friends with both $A$ and $C$ and $A$ wants to ask a favor of $C$, but $A$ and $C$ are not friends, then $A$ can ask a favor of $B$ and $B$ can ask the favor of $C$. \u003c/p\u003e\n\n\u003cp\u003e It is guaranteed that there always exist a way for every person to ask a favor of every other person. \u003c/p\u003e\n\nGiven the list of friends of each person in the network, and two IDs $A$ and $B$ where person $A$ wants to ask person $B$ a favor, find the minimum number of intermediate people needed for $A$ to ask a favor of $B$."}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe input consists of multiple test cases. The first line is the number of test cases $T$.\u003c/p\u003e\n\n\u003cp\u003eThe first line of each test case consists of a single integer $N$ which is the number of people in the network. \u003c/br\u003e\nThen, $N$ lines follow, 1 \u003c\u003d $N$ \u003c\u003d 10\u003csup\u003e5\u003c/sup\u003e. Each line contains a description of the friends list of a person in the network. The line starts with a integer $c$ which represents the ID of the person whose friends list is on this line. Then, a integer $n$\u003csub\u003ec\u003c/sub\u003e follows. This represents the number of people in the list. Then $n$\u003csub\u003ec\u003c/sub\u003e integers follow ($n$\u003csub\u003ec\u003c/sub\u003e \u003c\u003d 100), these are the IDs of the friends of $c$. \u003c/p\u003e\n\u003cp\u003e\nFinally, a line with two integers $A$ and $B$. These are the IDs mentioned in the question.\n\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output three integers: $A$, $B$, and the minimum number of intermediate people for $A$ to ask a favor of $B$. Note that the outputs of two consecutive cases should be separated by a blank line, but the last test case should not be followed by a blank line."}},{"title":"Sample Input","value":{"format":"HTML","content":"1\u003c/br\u003e\u003c/br\u003e\n4\u003c/br\u003e\n0 3 1 2 3\u003c/br\u003e\n1 1 0\u003c/br\u003e\n2 2 0 3\u003c/br\u003e\n3 2 0 2\u003c/br\u003e\n1 2\u003c/br\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"1 2 1"}}]}