#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define tr(x,container) for(auto &x:container)
#define fr(i,n) for(ll i=0;i<(n);++i)
#define frs(i,s,n) for(ll i=s;i<(n);++i)
#define frb(i,s,e) for(ll i=s;i<=(e);++i)
#define rfr(i,n) for(ll i=(n-1);i>=0;i--)
#define frbr(i,e,s) for(ll i=e;i>=(s);i--)
#define mset(m,v) memset(m,v,sizeof(m))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define find_bug(x) cout <<'>' << #x << " : " << x << endl;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#define dbg_arr(a,n)cerr << "[" << #a << "] = [ ";fr(i,n)cerr<<a[i]<<" ";cerr<<"]\n";
#define dbg_mat(m,r,c)cerr<<"[" <<#m<<"]:\n";fr(i,r){cerr<<"[ ";fr(j,c)cerr<<m[i][j]<<" ";cerr<<"]\n";}
#define dbg_time(t)cerr<<"Time elapsed: "<<t<<endl;
#else
#define dbg(x...){}
#define dbg_arr(a,n){}
#define dbg_mat(m,r,c){}
#define dbg_time(t){}
#endif

const ll MOD = 1e9+7;
const ll SMOD = 998244353;
const ll INF = 1e18;
const ll SINF = 1e9;
const ll MAX = 100100;

/*******************************************************************************************************************/

void pre()
{
  
}

void solve()
{
  ll arr[3][3],mark[3][3];

  fr(i,3)
  {
    fr(j,3)
    {
      arr[i][j] = 0;
      mark[i][j] = 0;
    }
  }

  fr(i,3)
  {
    fr(j,3)
    {
      cin >> arr[i][j]; 
    }
  }
  
  ll n;
  cin >> n;
  while(n--)
  {
    ll x; 
    cin >> x;
    fr(i,3)
    {
      fr(j,3)
      {
        if(arr[i][j] == x)
        {
          mark[i][j] = 1;
        }
      }
    }
  } 

  ll d1 = mark[0][0] + mark[1][1] + mark[2][2];
  ll d2 = mark[0][2] + mark[1][1] + mark[2][0];
  ll a1 = mark[0][0] + mark[0][1] + mark[0][2];
  ll a2 = mark[1][0] + mark[1][1] + mark[1][2];
  ll a3 = mark[2][0] + mark[2][1] + mark[2][2];
  ll b1 = mark[0][0] + mark[1][0] + mark[2][0];
  ll b2 = mark[0][1] + mark[1][1] + mark[2][1];
  ll b3 = mark[0][2] + mark[1][2] + mark[2][2];

  if(d1 == 3 || d2 == 3 || a1 == 3 || a2 == 3 || b1 == 3 || b2 == 3 || b3 == 3 || a3 == 3)
    cout << "Yes" << '\n';
  else
  {
    cout << "No" << '\n';
  }

}

signed main()
{  
    clock_t begin = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    //cout<<fixed<<setprecision(15);
    //pre();

    ll test = 1;
    // cin>>test;
    fr(ii,test)
    {
      // cout << "Case #" << ii + 1 << ": "<<endl;
      solve();
    }

    clock_t end = clock();
    double elapsed_secs = (double)(end - begin)/CLOCKS_PER_SEC;
    dbg_time(elapsed_secs);
    
    return 0;
}  


Measured memory_bytes: 256