const bingo = (card,nums)=>{
  'use strict';
  for(let n of nums){
    card.forEach(line =>{
      const i = line.indexOf(n);
      if(i!==-1){line[i] = -1}
    })
  }

  let lines = [
    [card[0][0], card[1][1], card[2][2]],
    [card[2][0], card[1][1], card[0][2]]
  ];
  for (let i = 0; i < 3; i++){
    lines.push([card[0][i],card[1][i],card[2][i]]);
    lines.push([card[i][0],card[i][1],card[i][2]]);
  }

  return lines.some(line=>check_line(line));
};

const check_line = line=>(line.reduce((a,b)=>a+b)) === -3;

function Main(input) {
  const input_ary = input.trim().split('\n')
  const card = [input_ary[0],input_ary[1],input_ary[2]].map(line=>line.split(' ').map(s=>parseInt(s)));
  const nums = input_ary.slice(4).map(n=>parseInt(n));
  const result = bingo(card,nums)
  console.log(result?'Yes':'No');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));