object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val range = 0 to 2
  val points = for {
    i <- range
    j <- range
  } yield (i, j)
  val lines = range.map(k => points.filter(_._1 == k)) ++
    range.map(k => points.filter(_._2 == k)) :+
    points.filter { case (i, j) => i == j } :+
    points.filter { case (i, j) => i + j == range.max }
  val bingo = points.map(sc.nextInt() -> _).toMap
  val winnings = Seq.fill(sc.nextInt())(sc.nextInt()).flatMap(bingo.get)
  println(if (lines.exists(line => line.forall(winnings.contains))) "Yes" else "No")
}
