'use strict'

const Main = (input) => {
  const tmp = input.trim().split('\n')
  const N = parseInt(tmp[3])

  const men = [
    tmp[0].split(' ').map(Number),
    tmp[1].split(' ').map(Number),
    tmp[2].split(' ').map(Number)
  ]

  for (let i = 4; i < 4 + N; i++) {
    const number = parseInt(tmp[i])
    for (let j = 0; j < men.length; j++) {
      if (men[j].indexOf(number) != -1) {
        men[j][men[j].indexOf(number)] = 0
      }
    }
  }

  let result = 'No'

  for (let k = 0; k < men.length; k++) {
    if (men[k][0] === 0 && men[k][1] === 0 && men[k][2] === 0) {
      result = 'Yes'
    } else if (men[0][k] === 0 && men[1][k] === 0 && men[2][k] === 0) {
      result = 'Yes'
    }
  }

  if (men[0][0] === 0 && men[1][1] === 0 && men[2][2] === 0) {
    result = 'Yes'
  } else if (men[2][0] === 0 && men[1][1] === 0 && men[0][2] === 0) {
    result = 'Yes'
  }

  console.log(result)
  return result
}

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