Cable Cleanup

No attempts yetTime limit1sMemory limit256 MB

Problem

At an ICPC regional contest, the operations team arrived at the site and only then found that the network of the contestant computers had been wired incorrectly. A large number of unneeded cables had been installed between the computers.

Abdelrahman, the director of operations, wants to remove as many cables as he can so that a runner is less likely to trip over one. Every computer still has to be reachable from every other computer after the removal. In the initial state all computers are reachable from each other.

Two computers are reachable from each other if a cable connects them directly. They are also reachable from each other if both of them are reachable from some third computer.

Find the maximum number of cables that can be removed.

Input

The first line contains the number of test cases TT, where 1T1001 \le T \le 100.

Each of the following TT lines holds one test case: two integers NN and MM separated by a single space, where NN is the number of computers in the contest hall and MM is the number of cables. The bounds are 1N1041 \le N \le 10^4 and N1M105N - 1 \le M \le 10^5.

The input does not say which computers each cable connects. It only guarantees that in the initial state all computers are reachable from each other.

Output

For each test case, print one line in the form Case n: R. Here nn is the test case number starting from 1, and RR is the maximum number of cables that can be removed.