You are given a map which contains N islands that are connected by M bridges. You are also given Q queries, each of which specify an island to be deleted. Once an island is deleted, all the bridges (if any) connected to the island are also deleted.
Write a program to find the number of pairs of islands that are no longer connected after each query is implemented.
Note:
For each new query, assume the initial unmodified map.
Input format
Output format
For each query, print the number of pairs of disconnected islands.
Constraints
1≤N,Q≤105
1≤A,B≤N
0≤M≤min(105,N⋅(N−1)/2)
For the 2nd query, when Island 2 gets deleted, Island 1 cannot reach Island 3 and Island 4. Hence, the output is 2.
Participants are requested to keep themself updated with the announcements of the contest.