- Time limit: 1.00 s
- Memory limit: 512 MB
A bank's been robbed! Fortunately the robbers have chosen their target exceptionally poorly: the bank resides on an island that has only one bridge out. The police is going to just set blockade on the bridge and wait for the thieves to come to them.
However, as a young and aspiring police officer Maija is having none of it. The robbers couldn't possibly be that stupid! She decides to take the matter to her own hands and rushes to put a blockade on the earliest road that the robbers have to cross in order to exit the island.
There are junctions numbered and bidirectional roads connecting them numbered . The -th road connects junctions and . The bank resides at junction and the bridge at junction . There is guaranteed to be a path between every pair of junctions.
Input
The first line contains two integers and . The -th of next lines contains two integers and .
Output
Print the index of the road that Maija should blockade or 0 if the bridge is the only road guaranteed to be on the robbers' path.
Constraints
- if
Example 1
Input:
5 6 1 4 3 4 4 5 2 3 2 4 1 2
Output:
3
Example 2
Input:
4 4 1 2 1 3 2 4 3 4
Output:
0
Example 2
Input:
3 2 2 3 1 2
Output:
2