BUSINESS - Mining your own business

题意翻译

有一座底下的稀有金属矿由n条隧道和一些连接点组成,其中每条隧道连接两个连接点。任意两个连接点之间最多只有一条隧道。为了降低矿工的危险,你的任务是在一些连接点处安装太平井,使得无论哪个连接点倒塌,不在此连接点的所有矿工都能到达太平井逃生(假定除了倒塌的连接点外,其他的连接点和隧道完好无损)。为了节约成本,你应当在尽量少的连接点安装太平井,还需要计算当太平井的数目最少时的安装方案总数。 【输入格式】 输入包含多组数据,第一行为隧道的条数n(n <= 50 000),以下为n行,每行两个整数,即一条隧道两端的连接点编号(所有连接点从1开始标号)。每组数据的所有连接点保证联通。 【输出格式】 对于每组数据,输出两个整数,即最少需要安装的太平井的数目以及对应的方案总数。方案总数保证在64位带符号整数的范围内。

题目描述

John Digger is the owner of a large illudium phosdex mine. The mine is made up of a series of tunnels that meet at various large junctions. Unlike some owners, Digger actually cares about the welfare of his workers and has a concern about the layout of the mine. Specifically, he worries that there may a junction which, in case of collapse, will cut off workers in one section of the mine from other workers (illudium phosdex, as you know, is highly unstable). To counter this, he wants to install special escape shafts from the junctions to the surface. He could install one escape shaft at each junction, but Digger doesn't care about his workers that much. Instead, he wants to install the minimum number of escape shafts so that if any of the junctions collapses, all the workers who survive the junction collapse will have a path to the surface. Write a program to calculate the minimum number of escape shafts and the total number of ways in which this minimum number of escape shafts can be installed.

输入输出格式

输入格式


The input consists of several test cases. The first line of each case contains a positive integer _N_ (_N_![$ le$](https://icpcarchive.ecs.baylor.edu/external/51/5135img1.png)5 $ ^{&nbsp;.&nbsp;} $ 10 $ ^{4} $ ) indicating the number of mine tunnels. Following this are _N_ lines each containing two distinct integers _s_ and _t_, where _s_ and _t_ are junction numbers. Junctions are numbered consecutively starting at 1. Each pair of junctions is joined by at most a single tunnel. Each set of mine tunnels forms one connected unit (that is, you can get from any one junction to any other). The last test case is followed by a line containing a single zero.

输出格式


For each test case, display its case number followed by the minimum number of escape shafts needed for the system of mine tunnels and the total number of ways these escape shafts can be installed. You may assume that the result fits in a signed 64-bit integer. Follow the format of the sample output.

输入输出样例

输入样例 #1

9
1 3
4 1
3 5
1 2
2 6
1 5
6 3
1 6
3 2
6 
1 2
1 3
2 4
2 5
3 6
3 7
0

输出样例 #1

Case 1: 2 4
Case 2: 4 1