#T97. 家庭问题

家庭问题

Description

There are n people labeled as 1, 2, ..., n, and there are K known relationships. Each relationship is represented as a pair (α, β), indicating that α and β are members of the same family. Given n, k, and the k relationships, determine the total number of families and the size of the largest family.

For example:
n = 6, k = 3, with the three relationships (1, 2), (1, 3), and (4, 5).
In this case, the 6 people form 3 families:

  • {1, 2, 3} as one family,
  • {4, 5} as another family,
  • {6} as a standalone family.
    The first family has the largest number of members.

Input Format

The first line contains two integers, n and k (1 ≤ n ≤ 100), separated by a space.
The following k lines each contain two integers separated by a space, representing a relationship.

Output Format

Two integers (the number of families and the size of the largest family), separated by a space.

6  3
1  2
1  3
4  5


3 3