Input Format
The first line contains two numbers n, m: The number of crossroads and the number of roads connecting them.
Some paths have reservoirs.
The next m lines contains three numbers a b c: a road from a to b with c indicating it has the a reservoir of the Ents draught if c is 1 and a parched road if c is 2.
Output Format
Prints the minimum number of parched roads needed to pass through to get to a point. If there is no path with at least one road with a reservoir print "-1".
Assume that they start from vertex number 1 and need to reach vertex number n.