"use strict"
function main(arg) {
    var data = arg.trim().split("\n")
    var table = []
    table.push(data.shift())
    table.push(data.shift())
    table.push(data.shift())
    table = table.map(e => e.split(" ").map(Number))
    data.shift()
    data = data.map(Number)
    for (var i = 0; i <  data.length; i++) {
        for (var y = 0; y < table.length; y++) for (var x = 0; x < table[0].length; x++) {
            if (table[y][x] === data[i]) {
                table[y][x] = 0
            }
        }
    }
    if (solve(table)) {
        console.log('Yes')
    } else {
        console.log('No')
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function solve(table) {
    // 横
    for (var y = 0; y < table.length; y++) {
        var sum = 0
        for (var x = 0; x < table[0].length; x++) {
            sum += table[y][x]
        }
        if (sum === 0) {
            return true
        }
    }
    // 縦
    for (var x = 0; x < table[0].length; x++) {
        var sum = 0
        for (var y = 0; y < table.length; y++) {
            sum += table[y][x]
        }
        if (sum === 0) {
            return true
        }
    }
    if ((table[0][0] + table[1][1] + table[2][2]) === 0) {
        return true
    }
    if ((table[0][2] + table[1][1] + table[2][0]) === 0) {
        return true
    }
    return false
}