object Main {
  def main(args:Array[String]) {
    var A = readLine().split(' ').map(_.toInt)
    var B = readLine().split(' ').map(_.toInt)
    var C = readLine().split(' ').map(_.toInt)
    val N = readLine().toInt
    var ans = "No"
    for(i <- 0 until N) {
      var num = readLine().toInt
      for(j <- 0 until 3) {
        if(A(j) == num) A(j) = -1
        else if(B(j) == num) B(j) = -1
        else if(C(j) == num) 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"
    else if((A(0) + B(1) + C(2)) == -3 || (A(2) + B(1) + C(0)) == -3) ans = "Yes"
    println(ans)
  }
}
