École polytechnique — nicknamed “X” — is famous for its network of camarades: former students of the school. Whenever a camarade needs something (money, a job, and so on), they can call on this network for help. To reach another camarade, not necessarily from the same class year, one can always find a chain of intermediate camarades who know one another. The camarade relationship is symmetric (if one knows the other, the other knows the first), and thanks to the network there is always a way to reach anybody.
Your task is to minimize the number of these intermediate camarades on the chain between two given people.
The first line contains an integer N (1≤N≤105), the number of camarades, labeled from 0 to N−1.
Each of the next N lines describes one camarade: it starts with that camarade's label c, followed by the number nc of camarades that c knows (nc<100), followed by the nc labels of those camarades. All integers on a line are separated by single spaces.
The last line contains two labels c1 and c2 (c2=c1): c1 is the camarade seeking help and c2 is the camarade whose help is sought.
Print three integers separated by single spaces: c1, c2, and the minimal number of intermediate camarades needed to reach c2 from c1.
The intermediate camarades are those strictly between c1 and c2 on a shortest chain; if c1 and c2 know each other directly, this number is 0.