// Arup Guha
// 4/26/2205
// Solution to COP 4516 Final Team Contest Problem: Rhinoceros Count

import java.util.*;

public class rhino {

	final public static int NUMRHINOS = 186;
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Go through the cases.
		for (int loop=1; loop<=nC; loop++) {
		
			// Number of days.
			int numDays = stdin.nextInt();
			
			// Initialized to 0 since we assume all were seen on day 0.
			int[] lastseen = new int[NUMRHINOS+1];
			
			// Print case header.
			System.out.println("Case "+loop+":");
			
			// Go through the days.
			for (int day=1; day<=numDays; day++) {
			
				// Get number of rangers who reported this day.
				int numRangers = stdin.nextInt();
				
				// Go through rangers.
				for (int j=0; j<numRangers; j++) {
				
					// Go through each rhino seen today.
					int seen = stdin.nextInt();
					for (int k=0; k<seen; k++) {
						int id = stdin.nextInt();
						
						// We've seen this rhino on day day.
						lastseen[id] = day;
					}
				}
			
				// Go through each rhino. Printing actions for next day.
				for (int j=1; j<=NUMRHINOS; j++) {
				
					// Full search.
					if (day - lastseen[j] >= 10)
						System.out.println("Day "+(day+1)+": Full Search "+j);
						
					// Extra ranger!
					else if (day - lastseen[j] >= 4)
						System.out.println("Day "+(day+1)+": Extra Ranger "+j);
				}
			} // end day loop
		} // end case loop
	} // end main
}