#d2810. 最短路计数
最短路计数
Shortest Path Counting
Problem Description
You are given an undirected, unweighted graph with vertices and edges.
For each vertex other than vertex , count how many different shortest paths lead from vertex to it.
Input Format
The first line contains two positive integers .
Each of the next lines contains two positive integers , meaning there is an edge from vertex to vertex (multiple edges and self-loops may exist).
Output Format
Output lines, each containing a non-negative integer. The -th line is the number of different shortest paths from vertex to vertex .
Since the answer may be large, output the result modulo .
If vertex cannot reach vertex , output .
Sample Input
5 7
1 2
1 3
2 4
3 4
2 3
4 5
4 5
Sample Output
1
1
1
2
4
Constraints
, .
Hint
Because the amount of data is large, please use fast input/output methods.