/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll m = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

ll f[2000010];

ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
ll binpow(ll a, ll b) {
     ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
 
ll find_ncr(ll n, ll r)
{
    ll m1=max(r,n-r);
    ll i,j,s,d=1,k;
    s=1;
 
    for(i=m1+1;i<=n;i++)
    {
        s=((s%m)*(i%m))%m;
    }
 
    m1=min(r,n-r);
 
    for(i=1;i<=m1;i++)
    {
        k=binpow(i,m-2);
        d=((d%m)*(k%m))%m;
    }
 
    k=(s%m*(d%m))%m;
 
    return k;
}

int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int  a[3][3],n;
  for (int i = 0; i < 3; ++i)
  {
    for (int j= 0; j < 3; ++j)
    {
      cin >> a[i][j];
    }
  }
  cin >> n;
  while(n--)
  {
    int v;
    cin >> v;
    for (int i = 0; i < 3; ++i)
    {
      for (int j= 0; j < 3; ++j)
      {
        if (a[i][j] == v)
        {
          a[i][j] = 0;
        }
      }
    }
  }
  for (int i = 0; i < 3; ++i)
  {
    int c= 0;
    for (int j= 0; j < 3; ++j)
    {
      if (a[i][j] == 0)
      {
        c++;
      }
    }
    if( c == 3)
    {
      cout << " Yes";
      return 0;
    }
  }
  for (int i = 0; i < 3; ++i)
  {
    int c= 0;
    for (int j= 0; j < 3; ++j)
    {
      if (a[j][i] == 0)
      {
        c++;
      }
    }
    if( c == 3)
    {
      cout << " Yes";
      return 0;
    }
  }
  if(a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
  {
    cout << "Yes";
    return 0;
  }
  if(a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0)
  {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}


Measured memory_bytes: 256