The bus lines of a city are known. Every line is a list of stops, and its buses drive the route in both directions - so once you are on a bus you may get off at any other stop of that same line. One such trip is called a ride, and changing to another bus starts a new ride.
Your task is to find the smallest number of rides needed to travel from a given starting stop to a given final stop.
Input
First line of input will be a single integer - the number of testcases.
First line of each testcase contains two integers and - the number of stops in the city and the number of bus lines. The stops are numbered to .
In the next lines will be one bus line each: first the number of stops on its route, and then distinct stop numbers.
Last line of the testcase contains two integers and - the starting and the final stop.
Output
For every testcase print a single line with the smallest number of rides needed to get from stop to stop . If it cannot be done, print . If and are the same stop the answer is , since no ride is needed.
Example
1 7 2 3 1 2 7 3 3 6 7 1 6
2
Board the first bus at stop and stay on it until stop , then change to the second bus, which carries you to stop . Two rides, and there is no way to do it in one - no single line holds both stop and stop .
Constraints
the stops listed for one bus line are distinct
the sum of over all testcases does not exceed
the sum of all over all testcases does not exceed
This problem was adapted, with permission, from Autobuske rute, authored by Društvo matematičara Srbije and Fondacija Petlja.