#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
 
int main() {
    int n,ans=0;
    vector<int>a(9),c(9);
    rep(i,9)cin>>c[i];
    cin>>n;
    vector<int>b(n);
    rep(i,n)cin>>b[i];
    rep(i,n)rep(j,9){
    	if(b[i]==c[j])a[j]=1;
    }
    if((a[0]&a[3]&a[6])|(a[1]&a[4]&a[7])|(a[2]&a[5]&a[8])|(a[0]&a[1]&a[2])|(a[3]&a[4]&a[5])|(a[6]&a[7]&a[8])|(a[0]&a[4]&a[8])|(a[2]&a[4]&a[6])){
    	cout<<"Yes";
    }
    else cout<<"No";
	return 0;
}