Interesting Computer Game
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Apollo is playing an interesting computer game. There are N rounds in the game.
At each round, the computer will give Apollo two integers (a_i and b_i), and Apollo can do exactly one of the following three actions.
  •  Apollo can do nothing.
  •  If integer a_i has not been selected in all previous rounds, Apollo can select integer a_i.
  •  If integer b_i has not been selected in all previous rounds, Apollo can select integer b_i.
Apollo has cracked the game, and he has known all the candidate numbers of each round before the game starts. Now he wants to know the maximum number of integers he can select with the optimal strategy.
I believe it would be very simple question for you, please help Apollo solve this question.

输入描述:

The first line is an integer  (), which is the number of test cases.

Each test case begins with a line containing a positive integer N (), indicating the number of rounds in this game.

Then N lines follow. The i-th line contains two integers a_i and b_i (, ), indicating that two integers of the i-th round.

输出描述:

For each test case, output one line containing , where x is the test case number and y is the answer.
示例1

输入

复制
2
6
1 2
2 3
3 4
1 4
1 3
2 4
5
1 2
1 2
1 3
2 3
5 6

输出

复制
Case #1: 4
Case #2: 4