import Foundation

let topLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let middleLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let buttomLine = readLine()!.components(separatedBy: " ").map{ Int($0)! }
let N = Int(readLine()!)!
var numbers: [Int] = []
var hit: [Bool] = [false,false,false,false,false,false,false,false,false]

for i in 0...N - 1{
    numbers.append(Int(readLine()!)!)
}

for i in 0...2 {
    for j in 0...N - 1{
        if topLine[i] == numbers[j]{
            hit[i] = true
            
        } else if middleLine[i] == numbers[j] {
            hit[i + 3] = true
            
        } else if buttomLine[i] == numbers[j] {
            hit[i + 6] = true
            
        }
    }
}

if hit[0] == true && hit[1] == true && hit[2] == true  {
    print("Yes")
} else if hit[3] == true && hit[4] == true && hit[5] == true{
    print("Yes")
} else if hit[6] == true && hit[7] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[3] == true && hit[6] == true{
    print("Yes")
} else if hit[1] == true && hit[4] == true && hit[7] == true{
    print("Yes")
} else if hit[2] == true && hit[5] == true && hit[8] == true{
    print("Yes")
} else if hit[0] == true && hit[4] == true && hit[8] == true{
    print("Yes")
} else if hit[2] == true && hit[4] == true && hit[6] == true{
    print("Yes")
} else {
    print("No")
}