Given a directed graph and two different vertices and , compute how many vertices different from and there are such that there exists some path from to passing through .
The input consists in several cases. Each case begins with , , and , followed by different pairs , with , which indicate an arc that goes from to . Assume , , and that the vertices are numbered between and .
For each case, write the number of vertices that can be visited when going from to following some path.
For each case, essentially the expected solution only makes two traversals, each on the right graph.
Input
9 7 4 9 8 7 7 1 7 2 7 5 1 3 2 3 3 4 6 4 4 0 2 0 1 0 3 0 1 2 1 2 2 0 4 0 2 3 0 2 2 3 3 0
Output
3 0 0 1