from itertools import permutations def possible(parts): for perm in permutations(parts): if all(perm[i] <= perm[i+1] for i in range(len(perm)-1)): return True, perm return False, None t = int(input()) for i in range(1, t+1): p = int(input()) parts = input().split() poss, perm = possible(parts) if poss: print(f"Case #{i}: POSSIBLE") print(" ".join(perm)) else: print(f"Case #{i}: IMPOSSIBLE")