'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const head = arr[0].split(' ').map(x => Number(x));
  const body = arr[1].split(' ').map(x => Number(x));
  const foot = arr[2].split(' ').map(x => Number(x));
  const n = arr[3];
  const num = [];
  let isBingo = false;

  for (let i = 0; i < n; i ++) {
    num[i] = arr[i + 4];
    for (let j = 0; j < a.length; j ++) {
      if (head[j] === num[i]) {
        head[j] = 0;
      }
      if (body[j] === num[i]) {
        body[j] = 0;
      }
      if (foot[j] === num[i]) {
        foot[j] = 0;
      }

    }
  }

  lowBingo(head);
  lowBingo(body);
  lowBingo(foot);

  rowBingo();
  
  console.log(isBingo ? 'Yes' : 'No');
}

function lowBingo(low) { //横の検証
  if (low[0] === 0 && low[1] === 0 && low[2] === 0) {
    return isBingo = true;
  }
}

function rowBingo() {
  for (let i = 0; i < head.length; i ++) {
    if (head[i] === 0 && body[i] === 0 && foot[i] === 0) {
      return isBingo = true;
    }
  }
  if ((body[1] === 0) &&
      ((head[0] === 0 && foot[2] === 0 )||
      (head[2] === 0 && foot[0] === 0))) {
    return isBingo = true;
  }
}


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