object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val pw = new java.io.PrintWriter(System.out)
	
	val a = Array.fill(9)(sc.nextInt)
	
	Seq.fill(sc.nextInt)(sc.nextInt) foreach {bi =>
		val i = a.indexWhere(_ == bi)
		if (i != -1)
			a(i) = 0
	}
	
	lazy val p = (a(0) == 0 && a(1) == 0 && a(2) == 0) || (a(3) == 0 && a(4) == 0 && a(5) == 0) || (a(6) == 0 && a(7) == 0 && a(8) == 0) ||
				 (a(0) == 0 && a(3) == 0 && a(6) == 0) || (a(1) == 0 && a(4) == 0 && a(7) == 0) || (a(2) == 0 && a(5) == 0 && a(8) == 0) ||
				 (a(0) == 0 && a(4) == 0 && a(8) == 0) || (a(2) == 0 && a(4) == 0 && a(6) == 0) 
	
	pw.println( if (p) "Yes" else "No" )
	pw.flush()
}