eolymp
bolt
Try our new interface for solving problems
Problems

Minimum and maximum connected component

Minimum and maximum connected component

An undirected graph is given. Find the size of its smallest and largest connected components. \InputFile The first line contains two positive integers $n$ and $m\:(1 \le n, m \le 10000)$ --- the number of vertices and edges of the graph. Each of the following $m$ lines contains two integers $a_i$ and $b_i\:(1 \le a_i, b_i \le n)$ --- the description of an undirected edge. \OutputFile Print on one line the size of the smallest and largest connected components of the graph. \includegraphics{https://static.eolymp.com/content/mf/mf2otks72h6braa5229tvcta4k.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
7 5
1 3
2 3
3 2
2 4
6 7
Output example #1
1 4