// Stephen Fulwider
// 22 July 2008
// Problem neighbor from BHCSI 2008 Final Programming Contest
//	Since there can be up to 1000 houses, this is way too many to try
//	each combination.  Instead, we can take a DP approach to solve
//	this, using the following recurrence relation:

//	best(0) = money(0)
//	best(1) = max(money(0),money(1))
//	best(n) = max(money(n)+best(n-2),best(n-1))

//	The first two are base cases--the best you can do with only one house is
//	whatever that house will give.  The best you can do with two houses is the
//	max value of those 2 houses.  After that the general relation is defined as
//	such: you can take the money which this house gives you and add it to the
//	best you can get by considering houses 0 through n-2, or you can not take
//	this house and take the best value possible by considering houses 0 through
//	n-1.  best(n) will always hold the best possible values considering houses
//	0 through n.  Once the entire array is filled in, the best value of considering
//	houses 0 through k-1 can be found in spot best[k-1].

import java.util.*;
import java.io.*;

public class neighbor
{		
	public static void main(String[] args) throws Exception
	{
		Scanner fin = new Scanner(new File("neighbor.in"));
		int N = fin.nextInt();
		int[] money, best;
		ArrayList<Integer>[] bestUsed;
		
		// process each test case
		for (int n=0; n<N; n++)
		{
			int K = fin.nextInt();
			
			// read in all donation values
			money = new int[K];
			for (int k=0; k<K; k++)
				money[k] = fin.nextInt();
			
			// seed best table with base cases and initialize bestUsed
			best = new int[K];
			bestUsed = new ArrayList[K];
			best[0] = money[0];
			bestUsed[0] = new ArrayList<Integer>();
			bestUsed[0].add(0);
			best[1] = Math.max(money[0], money[1]);
			bestUsed[1] = new ArrayList<Integer>();
			bestUsed[1].add(money[0] >= money[1] ? 0 : 1);
						
			// solve using dp, with the recurrence relation given above
			for (int k=2; k<K; k++)
			{
				best[k] = Math.max(money[k] + best[k-2], best[k-1]);
				
				// keep track of which house got added for this to be the max result
				if (best[k-1] > money[k] + best[k-2])
				{
					bestUsed[k] = (ArrayList<Integer>)bestUsed[k-1].clone();
				}
				
				// If the value is equal, we need to go to the tie-breaker.
				else if (best[k-1] == money[k] + best[k-2] && win(bestUsed[k-1],bestUsed[k-2])) {
					bestUsed[k] = (ArrayList<Integer>)bestUsed[k-1].clone();
				}
				else
				{
					bestUsed[k] = (ArrayList<Integer>)bestUsed[k-2].clone();
					bestUsed[k].add(k);
				}
			}
			
			// output optimum solution
			System.out.printf("Case #%d: %d :",n+1,best[K-1]);
			for (int h : bestUsed[K-1])
				System.out.printf(" %d", h);
			System.out.println();
		}
	}
	
	// Determines which list of houses is better, based on the tie-breaker in
	// the problem. Namely, true is returned if list a is better than list b.
	public static boolean win(ArrayList<Integer> a,ArrayList<Integer> b) {
		
		int i=0;
		
		// Loop until you find one list with a smaller house number.
		while (i<a.size() && i<b.size()) {
			if (a.get(i) < b.get(i))
				return true;
			else if (a.get(i) > b.get(i))
				return false;
			i++;
		}
		
		// If we get here a's list was identical to b's all the way through,
		// but a had more items, and it this case, we want a to win. This is
		// because we haven't yet added into b its last item...technically,
		// this is written specific to how the method is called above and that's
		// not a good practice.
		return true;
	}
}
