// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}



func main() {
    var card = [[Int]]()
    for _ in 0..<3 {
        card.append(readInts())
    }
    let n = Int(readLine()!)!
    
    //b入力用のループ
    for _ in 1...n {
        let b = Int(readLine()!)!
        // b探索用ループ
        for i in 0..<3 {
            for j in 0..<3 {
                card[i][j] = card[i][j] == b ? 0: card[i][j]
            }
        }
    }
    
    for i in 0..<3 {
        // 横のビンゴ
        if card[i] == [0, 0, 0,] {
            print("Yes")
            return
        }
        var count = 0
        // 縦のビンゴ
        for j in 0..<3 {
        
            count += card[i][j] == 0 ? 1: 0
        }
        if count == 3 {
            print("Yes")
            return
        }
    }
    // 斜めのビンゴ(真ん中が空いていないとビンゴしないためチェック)
    if card[1][1] == 0 {
        if card[0][0] == 0 && card[2][2] == 0 || card[0][2] == 0 && card[2][0] == 0 {
            print("Yes")
            return
        }
    }
    print("No")
    
}

main()



