LearnPy Hub
← Arena
AdvancedRating 1600

Biggest Group After Each Merge

n people start alone. After each merge 'a b' (their groups join), print the size of the largest group.

Input

n and q; then q lines 'a b'.

Output

q integers on one line.

Sample 1

Input
5 4
1 2
3 4
1 2
2 4
Output
2 2 2 4

Sample 2

Input
1 1
1 1
Output
1
solution.py
Output appears here
Biggest Group After Each Merge · Python Arena problem · LearnPy Hub