// Arup Guha
// 5/28/2016
// Solution to 2014 NCNA Problem G: Locked Treasure.
import java.util.*;

public class treasure {

    final public static int MAX = 46;

    public static void main(String[] args) {

        // This can go to 30 or so. I was lazy and reused my restaurant code.
        long[][] tri = new long[MAX][MAX];
        for (int i=0; i<MAX; i++) {
            tri[i][0] = 1;
            tri[i][i] = 1;
        }
        for (int i=2; i<MAX; i++)
            for (int j=1; j<i; j++)
                tri[i][j] = tri[i-1][j-1] + tri[i-1][j];

        Scanner stdin = new Scanner(System.in);
        int numCases = stdin.nextInt();

        // Process all cases since answer is just C(n, k-1) =)
        for (int loop = 1; loop<=numCases; loop++) {
            int n = stdin.nextInt();
            int k = stdin.nextInt();
            System.out.println("Case "+loop+": "+tri[n][k-1]);
        }
    }
}
