// Arup Guha
// 4/15/2023
// Solution to 2023 Code Jam Farewell Round A Problem C: Rainbow Sort

import java.util.*;

public class c {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();
		
		// Process cases.
		for (int loop=1; loop<=nC; loop++) {
			
			ArrayList<Integer> unique = new ArrayList<Integer>();
			HashSet<Integer> all = new HashSet<Integer>();
			int prev = -1;
			int n = stdin.nextInt();
			boolean flag = false;
			
			// Loop through values.
			for (int i=0; i<n; i++) {
				
				// Read this one.
				int val = stdin.nextInt();
				
				// There's a change...
				if (val != prev) {
					
					// If it's something from before, that's bad.
					if (all.contains(val)) flag = true;
					
					// We can add it now to our unique list.
					else unique.add(val);
				}
				
				// Update previous item and set of items.
				prev = val;
				all.add(val);
			}
			
			// Ta da!
			if (flag)
				System.out.println("Case #"+loop+": IMPOSSIBLE");
			else {
				System.out.print("Case #"+loop+":");
				for (int i=0; i<unique.size(); i++)
					System.out.print(" "+unique.get(i));
				System.out.println();
			}
		}
	}
}