#P17014. [GESP202606 七级] 染色
[GESP202606 七级] 染色
Problem Description
Student Xiao Yang has an undirected graph with vertices, where the vertices in are numbered in order.
Xiao Yang finds that the degree of every vertex in is . Obviously, there are exactly edges in .
Xiao Yang wants to color the vertices of so that the two endpoints of any edge have different colors.
Xiao Yang wants to know the minimum number of colors needed to color under this condition.
Input Format
This problem contains multiple test cases.
The first line contains a positive integer , which indicates the number of test cases.
For each test case:
The first line contains a positive integer , which indicates the number of vertices in the undirected graph .
The next lines each contain two positive integers , representing an undirected edge connecting vertex and vertex . Integers are separated by a space.
It is guaranteed that there are no multiple edges or self-loops in .
Output Format
For each test case, output one line with one integer, which is the minimum number of colors needed to color under the condition.
4
6
1 6
2 1
3 2
4 3
5 4
6 5
6
1 3
3 5
5 1
2 4
4 6
6 2
3
1 2
2 3
3 1
5
1 4
2 5
3 1
4 2
5 3
2
3
3
3
Hint
Constraints
For of the test points, it is guaranteed that , where is the sum of over all test cases in the input.
For all test points, it is guaranteed that , , and . It is guaranteed that there are no multiple edges or self-loops in .
Translated by ChatGPT 5