object Main extends App {
  import scala.io.StdIn.readLine
  import scala.io.StdIn.readInt
  
  	val bingo = (0 until 3).map(x => readLine.split(" ").map(_.toInt)).toList
  	val state = readInt;
  	val called = (0 until state).map(x => readInt).toList
  	val punched = bingo.map(_.map(x => called.contains(x)))
  	
  //this is the smartest solution in the universe
  	if(punched(0)(0) && punched(0)(1) && punched(0)(2)){println("Yes")}
  	else if(punched(1)(0) && punched(1)(1) && punched(1)(2)){println("Yes")}
  	else if(punched(2)(0) && punched(2)(1) && punched(2)(2)){println("Yes")}
  	else if(punched(0)(0) && punched(1)(0) && punched(2)(0)){println("Yes")}
  	else if(punched(0)(1) && punched(1)(1) && punched(2)(1)){println("Yes")}
  	else if(punched(0)(2) && punched(1)(2) && punched(2)(2)){println("Yes")}
  	else if(punched(0)(0) && punched(1)(1) && punched(2)(2)){println("Yes")}
    else if(punched(2)(0) && punched(1)(1) && punched(2)(0)){println("Yes")}
  	else println("No")
    
}