"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    let card = []
    for(let i = 0; i<3; i++){
        let tmp = input[i].split(" ").map(el => parseInt(el))
        card.push(tmp)
    }
    const N = parseInt(input[3]);
    let nums = []
    for(let i = 4; i<3+1+N;i++){
        let b = parseInt(input[i])
        for(let i = 0; i<3; i++){
            for(let j=0; j<3; j++){
                if(card[i][j] == b) card[i][j] = true
            }
        }
    }
    // raw
    for(let j = 0;j<3;j++){
        let r0 = true
        let r1 = true
        let r2 = true
        r0 = r0 && (card[0][j] == true)
        r1 = r1 && (card[1][j] == true)
        r2 = r2 && (card[2][j] == true)
        if(r0||r1||r2){
            console.log('Yes')
            return
        }
    }
    // column
    for(let i = 0;i<3;i++){
        let c0 = true
        let c1 = true
        let c2 = true
        c0 = c0 && (card[i][0] == true)
        c1 = c1 && (card[i][1] == true)
        c2 = c2 && (card[i][2] == true)
        if(c0||c1||c2){
            console.log('Yes')
            return
        }
    }
    // cross
    if(card[0][0] == true && card[1][1] == true && card[2][2] == true){
        console.log("Yes")
        return
    }
    if(card[2][0] == true && card[1][1] == true && card[0][2] == true){
        console.log("Yes")
        return
    }
    console.log("No")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  