In the far future, the most widely used form of public transportation is the hypertube. A single hypertube directly connects $K$ stations to one another; that is, you can travel between any two stations on the same hypertube in a single move. Starting from station $1$ and arriving at station $N$, find the minimum number of stations you visit. (Both the starting station and the destination station count as visited.)
The first line contains the number of stations $N$, the number of stations that one hypertube connects $K$, and the number of hypertubes $M$. ($1 \le N \le 100000$, $1 \le K, M \le 1000$)
Each of the next $M$ lines describes one hypertube. A line contains $K$ integers: the numbers of the stations that this hypertube connects to one another.
Print the minimum number of stations visited on a trip from station $1$ to station $N$. If station $N$ cannot be reached, print $-1$.