#graph204. POI 2008, BLO
POI 2008, BLO
POI 2008, BLO
Problem Description
Given an undirected connected graph with vertices and edges, with no multiple edges or self-loops. For each vertex, after deleting all its incident edges, how many pairs of vertices can no longer reach each other? The pairs are ordered, so and are counted twice.
Input Format
The first line contains two integers $n, m\ (1 \le n \le 10^5,\ 1 \le m \le 5 \times 10^5)$.
The next lines each contain two integers , denoting an undirected edge.
Output Format
lines, each containing one integer: the answer for the corresponding vertex.
Sample Input
5 5
1 2
2 3
1 3
3 4
4 5
Sample Output
8
8
16
14
8