object Main extends App {
    val input = for (l <- scala.io.Source.stdin.getLines.toList) yield l.split(" ").map(_.toInt).toList
    val card = Seq(input(0), input(1), input(2))
    val numbers = input.drop(4).map(_.head)

    val foo = for {
      c <- card
      n <- numbers
    } yield c.map(x => if (x == n) 0 else x)

    def isBingo(card: Seq[List[Int]]) = {
      (card(0)(0) == 0 && card(0)(1) == 0 && card(0)(2) == 0) ||
        (card(1)(0) == 0 && card(1)(1) == 0 && card(1)(2) == 0) ||
        (card(2)(0) == 0 && card(2)(1) == 0 && card(2)(2) == 0) || 
        (card(0)(0) == 0 && card(1)(0) == 0 && card(2)(0) == 0) ||
        (card(0)(1) == 0 && card(1)(1) == 0 && card(2)(1) == 0) ||
        (card(0)(2) == 0 && card(1)(2) == 0 && card(2)(2) == 0) || 
        (card(0)(0) == 0 && card(1)(1) == 0 && card(2)(2) == 0) ||
        (card(0)(2) == 0 && card(1)(1) == 0 && card(2)(0) == 0)
    }

    val answer = if(isBingo(foo)) "Yes" else "No"
    println(answer)
}