In Ninja World, World War is going on..
The Raikage Army and Zetsu Army are fighting each other. The war has become so fierce that, no one knows who will win. The ninjas of Leaf Village want to know who will survive finally. But leaf village ninjas are afraid of going to the battlefield.

So, they made a plan. They collected the information from the newspapers of Cloud Village(where the Raikage Army is from) and Kabutos territory(where the Zetsu Army is from). They found the information about all the dual fights. Dual fight means a fight between a member of Raikage Army and a member of Zetsu Army. 

Every solider of Raikage Army as well as of Zetsu Army have been allotted a unique id. The ninjas of Leaf Village knows the id of the dual fighters, but don't know which id belongs to Raikage Army or a Zetsu Army.

Actually, they want to find the maximum possible number of soldiers of Raikage Army. But since they are not good at programming so they ask for your help.
You as Naruto of the Hidden Leaf Village solve the problem for the Leaf Village ninjas.

Input Format
Input starts with an integer T , denoting the number of test cases.

Each case contains an integer N denoting the number of dual fights. Each of the next N lines will contain two different integers A,B denoting there was a fight between soldiers having id A and B.

Output Format
For each case, print the case number and the maximum possible members(soldiers) of Raikage Army.

Constraints
1 ≤ T ≤ 20
1 ≤ N ≤ 10^5
1 ≤ A, B ≤ 2*10^4

Given that both A & B will be of different army.

NOTE :-- USE FAST I/O METHODS.

Problem Setter : Ayush Verma  
Problem Tester :  Pranjul Dubey 

SAMPLE INPUT
4
4
1 2
2 3
2 4
2 5
6
2 6
1 5
3 4
7 9
5 8
4 10
1
100 200
4
1 2
2 3
3 4
4 5

SAMPLE OUTPUT
Case 1: 4
Case 2: 6
Case 3: 1
Case 4: 3

Explanation

For Case 1:-
Here {2} can belong to zetsu army and {1,3,4,5} can belong to raikage army....
So, the maximum number of soliders that can belong to raikage army is 4

For Case 2:-
Here {2,5,4,7} can belong to zetsu army and {6,1,3,9,8,10} can belong to raikage army....
So, the maximum number of soliders that can belong to raikage army is 6

For Case 4:-
Here {2,4} can belong to zetsu army and {1,3,5} can belong to raikage army....
from collections import defaultdict

class Graph():

    def __init__(self, connections=[], directed=False):
        self.status_dict      = defaultdict(lambda : 1)
        self.graph_dict       = defaultdict(list)
        self.is_directed      = directed
     


    def add_edge(self,node1, node2):
       
        self.graph_dict[node1].append(node2)
            
        if not self.is_directed:
            self.graph_dict[node2].append(node1)
                
      
    
    def add_vertex(self,node):
        self.graph_dict[node]
        self.status_dict[node]

    def pprint(self):
        for key,value in self.graph_dict.iteritems():
            print str(key)+":"+str(value)

def bfs(g,src_node):
    Q = []
    Q.append(src_node)
    g.status_dict[src_node] = 2
    
    occur_dict = [0]*(10**5)
    occur_dict[src_node] = 1
    set_1=1
    set_2=0
    
    while len(Q) !=0 :
        node = Q.pop(0)
        g.status_dict[node] = 3
        #print node,
        for nbs in g.graph_dict[node]:
            if  g.status_dict[nbs]   == 1:
                if occur_dict[node] == 1:
                    occur_dict[nbs] = 2
                    set_2+=1
                elif occur_dict[node] == 2:
                    occur_dict[nbs] = 1
                    set_1 += 1          
                Q.append(nbs)
                g.status_dict[nbs]   = 2
                
    return max(set_1,set_2)     

def connected_components(g):
    ans = 0 
    for node in g.graph_dict.keys():
        if g.status_dict[node]   == 1:
            
         
            ans += bfs(g,node)
            
    return ans
    
t= int(raw_input())
k=t
while t>0:
    g = Graph()
    ans = 0
    occur = defaultdict(int)
    
    N = int(raw_input())
    for i in range(N):
        A,B = [int(x) for x in raw_input().split()]
        g.add_edge(A,B)
        
 
    
    ans=connected_components(g)
    
    print "Case "+str(k-t+1)+":",ans    
    t -= 1