object Main extends App {
	val a = Array.ofDim[Int](3, 3)
	for(i<-0 until 3){
		a(i) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
	}
	val N = scala.io.StdIn.readInt
	for(i<-0 until N){
		val b = scala.io.StdIn.readInt

		if(a(0).contains(b)){
			a(0)(a(0).indexOf(b)) = 0
		}

		if(a(1).contains(b)){
			a(1)(a(1).indexOf(b)) = 0
		}

		if(a(2).contains(b)){
			a(2)(a(2).indexOf(b)) = 0
		}
	}

	var flag = false

	if(a(0).sum == 0 || a(1).sum == 0 || a(2).sum == 0) flag = true

	for(i<-0 until 3){
		if(a(0)(i) + a(1)(i) + a(2)(i) == 0) flag = true
	}

	if(a(0)(0) + a(1)(1) + a(2)(2) == 0) flag = true
	if(a(0)(2) + a(1)(1) + a(2)(0) == 0) flag = true

	if(flag) println("Yes")
	else println("No")

}
