"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A1 = arg[0].split(" ").map(n=>parseInt(n));
    const A2 = arg[1].split(" ").map(n=>parseInt(n));
    const A3 = arg[2].split(" ").map(n=>parseInt(n));
    const N  = arg[3];
    const B  = arg.slice(4, N + 3).map(n=>parseInt(n));
    
    let as = [A1, A2, A3];
    
    for(let i in B) {
        for(let j in as) {
            let del = as[j].indexOf(B[i]);
            
            if(del !== -1) {
                as[j][del] = "x";
            }   
        }
        
        const vert1 = [A1[0], A2[0], A3[0]]; 
        const vert2 = [A1[1], A2[1], A3[1]]; 
        const vert3 = [A1[2], A2[2], A3[2]]; 
        
        const cross1 = [A1[0], A2[1], A3[2]];
        const cross2 = [A3[0], A2[1], A1[2]];
    
        let temp = [A1, A2, A3, vert1, vert2, vert3, cross1, cross2];
        
        for(let j in temp) {
            if(temp[j].filter(n=>n === "x").length === temp[j].length) {
                console.log("Yes");
                return;
            }
        }
    }
    
    console.log("No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));