# Collector’s Problem

Some candy manufacturers put stickers into candy bar packages. Bob and his friends are collecting these stickers. They all want as many different stickers as possible, but when they buy a candy bar, they don’t know which sticker is inside. It happens that one person has duplicates of a certain sticker. Everyone trades duplicates for stickers he doesn’t possess. Since all stickers have the same value, the exchange ratio is always 1:1. But Bob is clever: he has realized that in some cases it is good for him to trade one of his duplicate stickers for a sticker he already possesses. Now assume, Bob’s friends will only exchange stickers with Bob, and they will give away only duplicate stickers in exchange with different stickers they don’t possess. Can you help Bob and tell him the maximum number of different stickers he can get by trading stickers with his friends? Input The first line of input contains the number of cases T (T ≤ 20). The first line of each case contains two integers n and m (2 ≤ n ≤ 10, 5 ≤ m ≤ 25). n is the number of people involved (including Bob), and m is the number of different stickers available. The next n lines describe each person’s stickers; the first of these lines describes Bob’s stickers. The i-th of these lines starts with a number ki ≤ 50 indicating how many stickers person i has. Then follows ki numbers between 1 and m indicating which stickers person i possesses. Output For each case, print the test case number together with the maximum number of different stickers Bob can get. Explanation of the sample output: In the first case, no exchange is possible, therefore Bob can have only the sticker with number 1. In the second case, Bob can exchange a sticker with number 1 against a sticker with number 2 of the second person, and then this sticker against a sticker with number 3 or 4 of the third person, and now he has stickers 1, 2 and 3 or 1, 2 and 4. Sample Input 2 25 6111111 3122 35 41211 3222 513443 Sample Output Case #1: 1 Case #2: 3