object Main extends App{
  import scala.io.StdIn._
  var A=readLine().split(" ").map(_.toInt)
  var B=readLine().split(" ").map(_.toInt)
  var C=readLine().split(" ").map(_.toInt)
  var N=readInt()
  var ans="No"
  for{i <- (0 until N )}{
    var s=readInt()
    for {j <- (0 until 3 )}{
      if(A(j)==s) {
        A(j) = -1
      }else if(B(j)==s){
        B(j) = -1
      }else if(C(j)==s){
        C(j)= -1
      }
      if(A(j)+B(j)+C(j) == -3) ans="Yes"
    }
  }
  if(A.sum== -3 || B.sum== -3 || C.sum== -3) ans="Yes"
  if(A(0)+B(1)+C(2)== -3 || C(0)+B(1)+A(2)== -3) ans="Yes"
  println(ans)
}