Score : $500$ points
Given is an undirected graph with $N$ vertices and $M$ edges.
Edge $i$ connects Vertices $A_i$ and $B_i$.
We will erase Vertices $1, 2, \ldots, N$ one by one.
Here, erasing Vertex $i$ means deleting Vertex $i$ and all edges incident to Vertex $i$ from the graph.
For each $i=1, 2, \ldots, N$, how many connected components does the graph have when vertices up to Vertex $i$ are deleted?
Input is given from Standard Input in the following format:
$N$ $M$ $A_1$ $B_1$ $A_2$ $B_2$ $\vdots$ $A_M$ $B_M$
Print $N$ lines.
The $i$-th line should contain the number of connected components in the graph when vertices up to Vertex $i$ are deleted.
6 7 1 2 1 4 1 5 2 4 2 3 3 5 3 6
1 2 3 2 1 0
The figure above shows the transition of the graph.
8 7 7 8 3 4 5 6 5 7 5 8 6 7 6 8
3 2 2 1 1 1 1 0
The graph may be disconnected from the beginning.