import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let R = Int(split[1])!

//
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }

*/

//
let array1 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let array2 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let array3 = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
let numbers = [array1, array2, array3]
var bingos = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

let N = Int(readLine()!)!
for i in 0..<N {
  var num = Int(readLine()!)!
  for i in 0...2 {
    for j in 0...2 {
      if num == numbers[i][j] {
        bingos[i][j] = 1
      }
    }
  }
}

if bingos[0] == [1, 1, 1] || bingos[1] == [1, 1, 1] || bingos[2] == [1, 1, 1] {
  print("Yes")
} else if bingos[0][0] == 1 && bingos[1][0] == 1 && bingos[2][0] == 1 {
  print("Yes")
} else if bingos[0][1] == 1 && bingos[1][1] == 1 && bingos[2][1] == 1 {
  print("Yes")
} else if bingos[0][2] == 1 && bingos[1][2] == 1 && bingos[2][2] == 1 {
  print("Yes")
} else if bingos[0][0] == 1 && bingos[1][1] == 1 && bingos[2][2] == 1 {
  print("Yes")
} else if bingos[0][2] == 1 && bingos[1][1] == 1 && bingos[2][0] == 1 {
  print("Yes")
} else {
  print("No")
}