public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		out = new StringBuilder();
		int nCase = 1;
		while ((line = in.readLine()) != null && line.length() != 0) {
			int[] nh = readInts(line);
			int n = nh[0], h = nh[1];
			if (n == 0 && h == 0)
				break;
			out.append("Case " + nCase++ + ":");
			if (n > (1 << (h)) - 1)
				out.append(" Impossible.\n");
			else {
				solve(1, n, h);
				out.append("\n");
			}
		}
		System.out.print(out);
	}