Tram
Tram network in Zagreb consists of several intersections and rails connecting some of them. In every intersection there is a switch pointing to the one of the rails going out of the intersection. When the tram enters the intersection it can leave only in the direction the switch is pointing. If the driver wants to go some other way, he/she must manually change the switch.
When a driver has do drive from intersection to the intersection he/she tries to choose the route that will minimize the number of times he/she will have to change the switches manually.
Write a program that will calculate the minimal number of switch changes necessary to travel from intersection to intersection .
Input
The first line contains integers and , where is the number of intersections in the network, numbered from to .
Each of the following lines contain a sequence of integers separated by a single blank character. First number in the -th line, , represents the number of rails going out of the -th intersection. Next numbers represents the intersections directly connected to the -th intersection. Switch in the -th intersection is initially pointing in the direction of the first intersection listed.
Output
The only line should contain the target minimal number. If there is no route from to the line should contain the integer .