There are values to represent nodes in a graph. They are divided into two sets and . Each set has exactly values. Set is represent by . can contain any value between to (inclusive). Set is represented by . can contain any value between to (inclusive). Same value can be chosen any number of times.
Here represents the edges of the graph.
Your task is to print the number of vertices in the smallest and the largest connected components of the graph.
Single nodes should not be considered in the answer.
For more clarity look at the following figure.
For the above graph smallest connected component is 7 and largest connected component is 17.
First line contains an integer .
Each of the next lines contain two space-separated integers, line contains and .
Print two space separated integers, the number of vertices in the smallest and the largest components.
The number of vertices in the smallest connected component in the graph is i.e. either or .
The number of vertices in the largest connected component in the graph is i.e. .