'use strict'
function main(inp) {
  inp = inp.trim().split('\n');
  let bingoPaper = [];
  bingoPaper.push(...inp[0].split(' '),...inp[1].split(' '),...inp[2].split(' '));
  let N = inp[3]*1;
  let rest = inp.slice(4,4 + N);
  // まずは印付
  for(let i = 0; i < N; i++){
  	if(bingoPaper.indexOf(rest[i]) >= 0){
 		   bingoPaper[bingoPaper.indexOf(rest[i])] = -1;
    }
  }
  // ビンゴかどうかの確認
  // jadgeはincludesが使いたいので文字列に（この条件なら大丈夫なはず）
  let jadge = "";
  for(let j = 0; j < 9; j++){
    if(bingoPaper[j] == -1){
    	jadge += j;
    }
  }
  let ans ="No";
  // あとはひたすら条件分の列挙
  // 横列判定系
  if(jadge.includes(0) && jadge.includes(1) && jadge.includes(2)){
  	ans = "Yes";
  }
  if(jadge.includes(3) && jadge.includes(4) && jadge.includes(5)){
  	ans = "Yes";
  }
  if(jadge.includes(6) && jadge.includes(7) && jadge.includes(8)){
  	ans = "Yes";
  }
  // 縦判定
  if(jadge.includes(0) && jadge.includes(3) && jadge.includes(6)){
  	ans = "Yes";
  }
  if(jadge.includes(1) && jadge.includes(4) && jadge.includes(7)){
  	ans = "Yes";
  }
  if(jadge.includes(2) && jadge.includes(5) && jadge.includes(8)){
  	ans = "Yes";
  }
  // 斜め判定
  if(jadge.includes(0) && jadge.includes(4) && jadge.includes(8)){
  	ans = "Yes";
  }
  if(jadge.includes(2) && jadge.includes(4) && jadge.includes(6)){
  	ans = "Yes";
  }
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
