function Main(input){
	input = input.split("\n");
	var bin_arr = [];
	for(var i = 0;i<3;i++){
		var temp = input[i].split(" ");
		for(var j = 0;j<3;j++)bin_arr[i*3+j] = parseInt(temp[j],10);
	}
	var N = parseInt(input[3],10);
	var b =[];
	for(var i = 0;i<N;i++)b.push(parseInt(input[i+4],10));
	for(var i= 0;i<9;i++){
		for(var j = 0;j<N;j++){
			if(bin_arr[i] === b[j])bin_arr[i] = 0;
		}
	}
	var result = false;
	for(var i= 0; i<7;i++){
		switch(i){
			case 0:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+4] && bin_arr[i] == bin_arr[i+8]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i] ==bin_arr[i + 6]){
				result = true;
			}
			break;
			case 1:
			if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6])result = true;
			break;
			case 2:
			if(bin_arr[i] == bin_arr[i+2] && bin_arr[i] == bin_arr[i+4]){
				result = true;
			}else if(bin_arr[i] == bin_arr[i+3] && bin_arr[i]== bin_arr[i+6]){
				result = true;
			}
			break;
			case 3:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
			case 6:
			if(bin_arr[i] == bin_arr[i+1] && bin_arr[i] == bin_arr[i+2])result = true;
			break;
		}//switch
	}
	console.log(result ? "Yes":"No");
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));
