public static void main(String[] args) {
		long start = System.currentTimeMillis();
		try {
			FileReader fr = new FileReader(SourcePath.getInputPath() + "/googleCodeJam/roundqualification2014/C-large-practice.in");
			FileWriter fw = new FileWriter(SourcePath.getOutputPath() + "/googleCodeJam/roundqualification2014/C-large-practice.out");

			BufferedReader br = new BufferedReader(fr);
			BufferedWriter bw = new BufferedWriter(fw);
			int numOfCases = Integer.valueOf(br.readLine());

			StringBuffer outPut = new StringBuffer();

			String result;

			String[] caseKeys;
			int rows;
			int columns;
			int mines;

			for (int i = 0; i < numOfCases; i++){
				caseKeys = br.readLine().split(" ");
				rows = Integer.parseInt(caseKeys[0]);
				columns = Integer.parseInt(caseKeys[1]);
				mines = Integer.parseInt(caseKeys[2]);

				result = getConfiguration(rows, columns, mines);

				System.out.println("Case #" + (i + 1) + ": " + result);
				outPut.append("Case #").append(i+1).append(": ").append(result).append("\n");
			}

			br.close();
			fr.close();
			bw.write(outPut.toString());
			bw.flush();
			bw.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (NumberFormatException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		long end = System.currentTimeMillis();

		System.out.println(end - start);
	}