function main(input)
{
  bingo = input.slice(0, 3);
  num = input.slice(3, input.length);
  B = []
  for(var i=0; i<3; i++){
    bingo_num = bingo[i].split(" ");
    B.push(bingo_num)
  }
  numset = new Set();
  for(var j =0; j<num.length; j++){
    numset.add(num[j]);
  }
  
  var result = 'No'
  bingo_flags =[]
  for (var n=0; n<3; n++){
    flag=[]
    line_sum = 0
  	for (var m=0; m<3; m++){
    	if(numset.has(B[n][m])){
            flag.push(1)
          	line_sum += 1
        }else{
         	flag.push(0)
        }   
    }
    //横ビンゴ
    if(line_sum === 3){
    	result = 'Yes'
    }
    bingo_flags.push(flag)
  }
  
  //縦ビンゴ
  for(var index = 0; index<3; index++){
   if(bingo_flags[0][index] + bingo_flags[1][index] + bingo_flags[2][index] ===3){
   	 result= 'Yes'
   }
  }
  
  //斜めビンゴ
  center = bingo_flags[1][1]
  b1 = bingo_flags[0][0] + center + bingo_flags[2][2]
  b2 = bingo_flags[0][2] + center + bingo_flags[2][0]
  if(b1 ===3 || b2 ===3){
    result = 'Yes'
  }
  
  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))