// Arup Guha
// 4/11/2016
// Solution to 2016 Code Jam Qualification Problem D: Fractiles

import java.util.*;

public class d {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {

			// Get input.
			int k = stdin.nextInt();
			int c = stdin.nextInt();
			int s = stdin.nextInt();

			// This is when we can't do it.
			if (c*s < k)
				System.out.println("Case #"+loop+": IMPOSSIBLE");

			// Regular case
			else {

				// Initial valid solution.
				ArrayList<Long> res = new ArrayList<Long>();

				// Here is the idea: grab c items at a time and merge into one item in the last list...
				for (int i=0; i<k; i+=c) {
					long item = resolve(i, Math.min(i+c-1,k-1) , c, k);
					res.add(item);
				}

				// Print result.
				System.out.print("Case #"+loop+":");
				for (int i=0; i<res.size(); i++)
					System.out.print(" "+(res.get(i)+1));
				System.out.println();
			}
		}
	}

	// merge c items into one.
	public static long resolve(int start, int end, int c, int k) {

		// This is our "base" - the range we are matching to.
		long cur = start;

		// Here is the merging process, much like base conversion.
		for (int i=start+1; i<=end; i++)
			cur = cur*k + i;

		// This is just for the last range, if there are no new numbers to build up to the right level.
		for (int i=end-start; i<c-1; i++)
			cur *=k;

		return cur;
	}
}