Bees are one of the most industrious insects. They collect nectar and pollen from the flowers and thus they rely on the trees in the forest. For better navigability, they numbered the n trees from 0 to n - 1. Instead of roaming around all over the forest, they use a predefined map consisting of some paths. A path is based on two trees, and the bees fly from one tree to another in a straight line. They don't use paths that are not on their map.
As technology has been improved a lot, they also changed their working strategy. Instead of hovering over all the trees in the forest, they are targeting particular trees, mainly trees with lots of flowers. To make things even better, they are planning to build some new hives on some targeted trees. Once done, they will only collect pollens from those trees and the unnecessary paths will be removed from their map.
Now, they want to build the hives such that if one of the paths in their new map become unavailable (some birds or animals interrupting them in that path), it's still possible to go from any hive to another using the other paths in their new map.
The bees don't want to choose less than two trees and they also want to build minimum number of hives. Now you are given the trees with the current map, your task is to propose a new bee hive colony for them.
Input
Input starts with an integer T (≤ 50), denoting the number of test cases.
Each case starts with a blank line. Next line contains two integers n (2 ≤ n ≤ 500) and m (0 ≤ m ≤ 20000), where n denotes the number of trees and m denotes the number of paths. Each of the next m lines contains two integers u v (0 ≤ u, v < n, u ≠ v) meaning that there is a path between tree u and v. Assume that there can be at most one path between any pair of trees.
Output
For each case, print the case number and the number of beehives in the proposed colony or impossible
if it's impossible to find such a colony.
Sample
Sample Input | Sample Output |
---|---|
3 3 3 0 1 1 2 2 0 2 1 0 1 5 6 0 1 1 2 1 3 2 3 0 4 3 4 | Case 1: 3 Case 2: impossible Case 3: 3 |
Notes
- Dataset is huge, use faster I/O methods.
- For case 3, the bees will build 3 hives in node {1, 2, 3} and they will only maintain three roads in the colony - {(1, 2), (1, 3), (2, 3)}.