process.stdin.resume();
process.stdin.setEncoding('utf8');

function Main(input){
    var A = [];
    for (var i=0; i<3; i++){
	    A[i] = [,,,];
    }
    var lines = input.split("\n");
    for (var i=0; i<3; i++){
        var row = lines[i].split(" ");
        for (var j=0; j<3; j++){
            A[i][j] = parseInt(row[j]);
        }
    }
    var n = parseInt(lines[3]);
    for (var i=4; i<=4+n; i++){
        var b = parseInt(lines[i]);
        for (var j=0; j<3; j++){
            for (var k=0; k<3; k++){
                if (A[j][k] == b){
                    A[j][k] = -1;
                }
            }
        }
    }
    var flag = false;
    for (var i=0; i<3; i++){
        if (A[0][i] == A[1][i] && A[1][i] == A[2][i] && A[2][i] == -1){
            flag = true;
        }
    }
    for (var i=0; i<3; i++){
        if (A[i][0] == A[i][1] && A[i][1] == A[i][2] && A[i][2] == -1){
            flag = true;
        }
    }
    
    if (A[0][0] == A[1][1] && A[1][1] == A[2][2] && A[2][2] == -1){
        flag = true;
    }

    if (A[0][2] == A[1][1] && A[1][1] == A[2][0] && A[2][0] == -1){
        flag = true;
    }
    
    if (flag){
        console.log("Yes");
    } else{
        console.log("No");
    }
    
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));