//   2次配列のよみこみ

function Main(input) {
    input = input.split("\n");
  
    a = input[0].split(" ").map(Number);
    b = input[1].split(" ").map(Number);
    c = input[2].split(" ").map(Number);
    
    n = Number(input[3].split(" "));
    a = a.concat(b);
    a = a.concat(c);

//console.log(a);

var r=[0,0,0,0,0,0,0,0,0];
for(i=4;i<n+4;i++){
    m = Number(input[i].split(" "));
    var result = a.indexOf(m);
    if(result!==-1){
             r[result]=1;}
    }
 // console.log(r);
  var ans=0;
  if(r[0]==1&&r[1]==1&&r[2]==1){var ans=1;}
   if(r[3]==1&&r[4]==1&&r[5]==1){var ans=1;}
    if(r[6]==1&&r[7]==1&&r[8]==1){var ans=1;}
     if(r[1]==1&&r[4]==1&&r[7]==1){var ans=1;}
      if(r[2]==1&&r[5]==1&&r[8]==1){var ans=1;}
       if(r[0]==1&&r[4]==1&&r[8]==1){var ans=1;}
       if(r[2]==1&&r[4]==1&&r[6]==1){var ans=1;}
        if(r[0]==1&&r[3]==1&&r[6]==1){var ans=1;}
   if(ans==1){console.log('Yes');}else{console.log('No');}    
  
  
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));