public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		out = new StringBuilder();
		ring = new int[16];
		int times = 1;
		while ((line = in.readLine()) != null && line.length() != 0) {
			if (times != 1)
				out.append("\n");
			out.append("Case " + times++ + ":\n");
			sizeRing = Integer.parseInt(line.trim());
			ring[0] = 1;
			back(1, 2, " 1");
		}
		System.out.print(out);
	}