const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')

const A = []
A.push(...lines[0].split(' ').map(Number))
A.push(...lines[1].split(' ').map(Number))
A.push(...lines[2].split(' ').map(Number))

const N = lines[3] - 0
const b = []
for (let i = 0; i < N; i++) {
  b[i] = lines[i + 4] - 0
}

for (let i = 0; i < N; i++) {
  for (let j = 0; j < A.length; j++) {
    if (A[j] === b[i]) {
      A[j] = 'b'
    }
  }
}

let ans = 'No'
if (A[0] === 'b' && A[4] === 'b' && A[8] === 'b') {
  ans = 'Yes'
} else if (A[2] === 'b' && A[4] === 'b' && A[6] === 'b') {
  ans = 'Yes'
} else if (A[0] === 'b' && A[1] === 'b' && A[2] === 'b') {
  ans = 'Yes'
} else if (A[3] === 'b' && A[4] === 'b' && A[5] === 'b') {
  ans = 'Yes'
} else if (A[6] === 'b' && A[7] === 'b' && A[8] === 'b') {
  ans = 'Yes'
} else if (A[0] === 'b' && A[3] === 'b' && A[6] === 'b') {
  ans = 'Yes'
} else if (A[1] === 'b' && A[4] === 'b' && A[7] === 'b') {
  ans = 'Yes'
} else if (A[2] === 'b' && A[6] === 'b' && A[8] === 'b') {
  ans = 'Yes'
}
console.log(ans)