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

			BufferedReader br = new BufferedReader(fr);
			BufferedWriter bw = new BufferedWriter(fw);
			int numOfCases = Integer.valueOf(br.readLine());
			
			StringBuffer outPut = new StringBuffer();
			int firstChoice;
			String[][] firstSquare;
			int secondChoice;
			String[][] secondSquare;
			String result;
			List<Integer> choiceNums;
			
			String badMagician = "Bad magician!";
			String volunteerCheated = "Volunteer cheated!";
			
			for (int i = 0; i < numOfCases; i++){
				firstChoice = Integer.valueOf(br.readLine());
				
				firstSquare = new String[4][4];
				for (int j = 0; j < 4; j++){
					firstSquare[j] = br.readLine().split(" ");
				}
				
				secondChoice = Integer.valueOf(br.readLine());
				secondSquare = new String[4][4];
				for (int k = 0; k < 4; k++){
					secondSquare[k] = br.readLine().split(" ");
				}
				
				choiceNums = getChoiceNums(firstSquare[firstChoice - 1], secondSquare[secondChoice - 1]);
				if (choiceNums.size() == 1){
					result = String.valueOf(choiceNums.get(0));
				} else if (choiceNums.size() > 1){
					result = badMagician;
				} else {
					result = volunteerCheated;
				}
				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);
	}