import java.util.*;
import java.io.*;

public class DancingWithTheGooglers
{
    public DancingWithTheGooglers()
    {
        Scanner inFile = null;
        try
        {
            inFile = new Scanner(new File("inputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening input file. Exiting...");
			System.exit(0);
        }
        int t = inFile.nextInt();
        
        int [] results = new int [t];
        DancingWithTheGooglersMax [] rnc = new DancingWithTheGooglersMax[t];
        
        int i, j;
        int [] scores;
        int s, p;
        for(i = 0; i < t; i++)
        {
            scores = new int [inFile.nextInt()];
            s = inFile.nextInt();
            p = inFile.nextInt();
            for(j = 0; j < scores.length; j++)
                scores[j] = inFile.nextInt();
            
            rnc[i] = new DancingWithTheGooglersMax(i, scores, s, p, results);
            rnc[i].start();
        }
        inFile.close();
        
        boolean done = false;
        
        while(!done)
        {
            done = true;
            for(i = 0; i < t; i++)
                if(rnc[i].isAlive())
                {
                    done = false;
                    break;
                }
        }
        
        PrintWriter outFile = null;
        try
        {
            outFile = new PrintWriter(new File("outputB.txt"));
        }
        catch(Exception e)
        {
            System.out.println("Problem opening output file. Exiting...");
			System.exit(0);
        }
        
        for(i = 0; i < results.length; i++)
            outFile.printf("Case #%d: %d\n", i+1, results[i]);
        outFile.close();
    }
    
    public static void main(String [] args)
    {
        new DancingWithTheGooglers();
    }
    
    private class DancingWithTheGooglersMax extends Thread
    {
        int id;
        int s, p;
        int [] results, scores;
        
        public DancingWithTheGooglersMax(int i, int [] aScores, int aS, int aP,int [] res)
        {
            id = i;
            s = aS;
            p = aP;
            results = res;
            scores = aScores;
        }
        
        public void run()
        {
            int a = 0, b = 0;
            
            if(p == 0)
                results[id] = scores.length;
            else if(p == 1)
            {
                int y;
                y = 3*p - 3;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > 0)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
            else
            {
                int y, z;
                y = 3*p - 3;
                z = 3*p - 5;
                
                for(int i = 0; i < scores.length; i++)
                    if(scores[i] > y)
                        a++;
                    else if(scores[i] > z)
                        b++;
                
                b = Math.min(b, s);
                results[id] = a+b;
            }
        }
    }
}
import java.io.*;
import java.util.Arrays;

public class Main{
	
	public static void main(String[] args) throws Exception {
		int t = Integer.parseInt(finB.readLine());
		int test = 1;
		while(test <= t){
			int n = fnextInt();
			int s = fnextInt();
			int p = fnextInt();
			int[] a = new int[n];
			for(int i = 0; i < n; i++){
				a[i] = fnextInt();
			}
			print(n + " " + s + " " + p + " ");
			for(int i = 0; i < n; i++){
				print(a[i] + " ");
			}
			int[] max = new int[n];
			for(int i = 0; i < n; i++){
				if(a[i] / 3 == 0){
					if(p == 2 && a[i] == 2 && s > 0){
						max[i] = a[i];
						s--;
						continue;
					}
					else if(a[i] == 2) max[i] = 1;
					else max[i] = a[i];
					continue;
				}
				if(a[i] % 3 == 0 && a[i] / 3 < p){
					if(s > 0 && a[i] / 3 + 1 == p){
						max[i] = a[i] / 3 + 1;
						s--;
						continue;
					}
				}
				if(a[i] % 3 == 2 && a[i] / 3 + 1 < p){
					if(s > 0 && a[i] / 3 + 2 == p){
						max[i] = a[i] / 3 + 2;
						s--;
						continue;
					}
				}
				max[i] = a[i] % 3 > 0 ? a[i] / 3 + 1 : a[i] / 3;
			}
			int ans = 0;
			for(int i = 0; i < n; i++){
				if(max[i] >= p) ans++;
			}
			fout.println("Case #" + test + ": " + ans);
			println("Case #" + test + ": " + ans);
			test++;
		}
		fout.flush();
	}
		
	private static PrintWriter out;
	private static BufferedReader inB;
	private static BufferedReader finB;
	private static PrintWriter fout;
	
	
	static {
		try {
			finB = new BufferedReader(new InputStreamReader(new FileInputStream("input.in")));
			fout = new PrintWriter(new FileOutputStream("output.txt"));
			out = new PrintWriter(System.out);
			inB = new BufferedReader(new InputStreamReader(System.in));
		} catch(Exception e) {e.printStackTrace();}
	}
	
	private static StreamTokenizer in = new StreamTokenizer(inB);
	private static StreamTokenizer fin = new StreamTokenizer(finB);
	
	private static void exit(Object o) throws Exception {
		out.println(o);
		out.flush();
		System.exit(0);
	}
	private static void println(Object o) throws Exception{
		out.println(o);
		out.flush();
	}
	private static void print(Object o) throws Exception{
		out.print(o);
		out.flush();
	}
	private static int fnextInt() throws Exception {
		fin.nextToken();
		return (int)fin.nval;
	}  
	private static int nextInt() throws Exception {
		in.nextToken();
		return (int)in.nval;
	}  
	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;        
	}
} 