
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  sc.useDelimiter("\n")
  val A1 = sc.next().split(' ').map(_.toInt).toList
  val A2 = sc.next().split(' ').map(_.toInt).toList
  val A3 = sc.next().split(' ').map(_.toInt).toList
  val A = Seq(A1, A2, A3)
  val N = sc.nextInt()
  val b = for (i <- 0 until N) yield sc.nextInt()
  // 存在するを0と置く
  val result = A.map(l => l.map(a => if(b.contains(a)) 0 else a)).toList
  if (exists(result)) {
    println("Yes")
  } else {
    println("No")
  }

  def exists(b: List[List[Int]]): Boolean = {
    b match {
      case List(List(0, 0, 0), List(a, b, c), List(d, e, f)) => true
      case List(List(a, b, c), List(0, 0, 0), List(d, e, f)) => true
      case List(List(a, b, c), List(d, e, f), List(0, 0, 0)) => true
      case List(List(0, a, b), List(0, c, d), List(0, e, f)) => true
      case List(List(a, 0, b), List(c, 0, d), List(e, 0, f)) => true
      case List(List(a, b, 0), List(c, d, 0), List(e, f, 0)) => true
      case List(List(0, a, b), List(c, 0, d), List(e, f, 0)) => true
      case List(List(a, b, 0), List(c, 0, d), List(0, e, f)) => true 
      case _ => false
    }
  }

}