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

// 標準入力取込
var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});
process.stdin.on('end', function() {
    main(g_input.split(/\r?\n/));
});

const vertical = 3;
const width = 3;

// 解答
function main(inputs){

    // ビンゴカード
    var bingoCard = [inputs[0].split(" "), inputs[1].split(" "), inputs[2].split(" ")];
    // 選ばれた数
    var selectedNum = inputs[3];
    // 選ばれた数値リスト
    var numList = [selectedNum];
    var hit = [[0,0,0],[0,0,0],[0,0,0]];
    var verticalHit = new Array(width);
    var widthHit = 0;

    // 入力値格納
    for (var i = 0; i < selectedNum; i++) {

        numList[i] = inputs[i + 4];
    }

    // ビンゴ判定(縦横)
    for (var m = 0; m < vertical; m++) {

        widthHit = 0;

        for (var n = 0; n < width; n++) {
            if (numList.indexOf(bingoCard[m][n]) > -1) {

                widthHit++;
                hit[m][n] = 1;

                if (verticalHit[n] != 0) {

                    verticalHit[n] = 1;
                }
            } else {

                verticalHit[n] = 0;
            }

            if (n == width - 1
                && ((widthHit == 3)
                   || (m == vertical - 1 && verticalHit.indexOf(1) > -1))) {

                console.log('Yes');
                return;
            }
        }
    }

    // ビンゴ判定(斜め)
    if (crossBingoCheck(hit) === true) {

        console.log('Yes');
        return;
    }

    console.log('No');
}

function crossBingoCheck(hit){

    if ((hit[0][0] + hit[1][1] + hit[2][2] === 3)
       || (hit[0][2] + hit[1][1] + hit[2][0] === 3)) {

        return true;
    }
    
    return false;
}