/* Check cf5-opt.vim defs.
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
VIM: let g:wcppflags="/O2 /EHsc /DWIN32"
VIM: let g:cppflags=g:Iboost.g:Itbb
VIM: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy
VIM: let g:ldlibpath=g:Bboost.g:Btbb
VIM: let g:argv=" < tic_tac_toy_tomek.sample_input"
*/
#include <iostream>
#include <exception>
#include <vector>
#include <string>
#include <algorithm>
#include <stdexcept>

/*
Problem A. Magic Trick
Confused? Read the quick-start guide.
Small input
6 points	
You have solved this input set.
Note: To advance to the next rounds, you will need to score 25 points. Solving just this problem will not give you enough points.

Problem

Recently you went to a magic show. You were very impressed by one of the tricks, so you decided to try to figure out the secret behind it!

The magician starts by arranging 16 cards in a square grid: 4 rows of cards, with 4 cards in each row. Each card has a different number from 1 to 16 written on the side that is showing. Next, the magician asks a volunteer to choose a card, and to tell him which row that card is in.

Finally, the magician arranges the 16 cards in a square grid again, possibly in a different order. Once again, he asks the volunteer which row her card is in. With only the answers to these two questions, the magician then correctly determines which card the volunteer chose. Amazing, right?

You decide to write a program to help you understand the magician's technique. The program will be given the two arrangements of the cards, and the volunteer's answers to the two questions: the row number of the selected card in the first arrangement, and the row number of the selected card in the second arrangement. The rows are numbered 1 to 4 from top to bottom.

Your program should determine which card the volunteer chose; or if there is more than one card the volunteer might have chosen (the magician did a bad job); or if there's no card consistent with the volunteer's answers (the volunteer cheated).

Solving this problem

Usually, Google Code Jam problems have 1 Small input and 1 Large input. This problem has only 1 Small input. Once you have solved the Small input, you have finished solving this problem.

Input

The first line of the input gives the number of test cases, T. T test cases follow. Each test case starts with a line containing an integer: the answer to the first question. The next 4 lines represent the first arrangement of the cards: each contains 4 integers, separated by a single space. The next line contains the answer to the second question, and the following four lines contain the second arrangement in the same format.

Output

For each test case, output one line containing "Case #x: y", where x is the test case number (starting from 1).

If there is a single card the volunteer could have chosen, y should be the number on the card. If there are multiple cards the volunteer could have chosen, y should be "Bad magician!", without the quotes. If there are no cards consistent with the volunteer's answers, y should be "Volunteer cheated!", without the quotes. The text needs to be exactly right, so consider copying/pasting it from here.

Limits

1 <= T <= 100.
1 <= both answers <= 4.
Each number from 1 to 16 will appear exactly once in each arrangement.
*/

typedef std::vector<int> arrangement_type;
struct puzzle_type
{
	arrangement_type arr1;
	arrangement_type arr2;
	int ans1;
	int ans2;
};

void read_puzzle( puzzle_type& puzzle )
{
	puzzle.arr1.clear();
	puzzle.arr2.clear();
	//
	// arrangement 1
	//
	std::cin >> puzzle.ans1;
	for ( int i = 0; i < 16; ++i )
	{
		int c;
		std::cin >> c;
		puzzle.arr1.push_back(c);
	}
	//
	// arrangement 2
	//
	std::cin >> puzzle.ans2;
	for ( int i = 0; i < 16; ++i )
	{
		int c;
		std::cin >> c;
		puzzle.arr2.push_back(c);
	}
}

int solve_puzzle( puzzle_type& puzzle )
{
	arrangement_type::iterator r1b = puzzle.arr1.begin() + (puzzle.ans1-1)*4;
	arrangement_type::iterator r1e = r1b+4;
	std::sort(r1b,r1e);

	arrangement_type::iterator r2b = puzzle.arr2.begin() + (puzzle.ans2-1)*4;
	arrangement_type::iterator r2e = r2b+4;
	std::sort(r2b,r2e);

	int ans;
	int cnt = 0;
	while ( r1b != r1e && r2b != r2e )
	{
		if ( *r1b < *r2b )
			++r1b;
		else if ( *r1b > *r2b )
			++r2b;
		else //if ( *r1b == *r2b )
		{
			ans = *r1b;
			cnt++;
			++r1b;
			++r2b;
		}
	}

	if ( cnt > 1 )
		return -1;
	else if ( cnt == 0 )
		return -2;
	else
		return ans;
}

const char * msg [] = {
		"Bad magician!",
		"Volunteer cheated!"
};

int main ( void )
{try{

	int puzzle_count;
	puzzle_type puzzle;

	std::cin >>	puzzle_count;
	std::cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
	for ( int i = 0; i < puzzle_count; i++ )
	{
		read_puzzle(puzzle);
		int s = solve_puzzle(puzzle);
		if ( s >= 0 )
			std::cout << "Case #" << (i+1) << ": " << s << std::endl;
		else
			std::cout << "Case #" << (i+1) << ": " << msg[-s-1] << std::endl;
	}

	return 0;
}
catch ( const std::exception& e )
{
	std::cerr << std::endl
			<< "std::exception(\"" << e.what() << "\")." << std::endl;
	return 2;
}
catch ( ... )
{
	std::cerr  << std::endl
			<< "unknown exception." << std::endl;
	return 1;
}}

