#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod         (ll)1000000007
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = (ll)1e18;
ld pi = 3.141592653589;
using namespace std;

ll bpow(ll x, ll v) {	
	if (v == 0)
		return 1 % mod;
	if (v % 2 == 1)
		return (x * bpow(x, v - 1)) % mod;
	ll r = bpow(x, v / 2);
	return (r * r) % mod;	
}

ll lcm(ll a,ll b)
{
	ll ret=(a*b)/__gcd(a,b);
	return ret;
} 
ll a[3][3];
ml m;
bool che(){
	bool ans = false;
	lp(i,0,3)
	if(m[a[i][0]] and m[a[i][1]] and m[a[i][2]])
		return true;
	lp(i,0,3)
	if(m[a[0][i]] and m[a[1][i]] and m[a[2][i]])
		return true;
	if((m[a[0][0]] and m[a[1][1]] and m[a[2][2]]) or (m[a[0][2]] and m[a[1][1]] and m[a[2][0]]))
		return true;
}

ll solve(){ 
	lp(i,0,3){
		lp(j,0,3)
		cin>>a[i][j];
	}
	ll n,f=0; cin>>n;
	while(n--){
		ll p; cin>>p;
		m[p]=1;
		if(che()){
			f=1;
		}
	}
	if(f) cout<<"Yes";
	else cout<<"No";
}

int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
    	solve();
    }
}