#if __has_include("D:/dhiraj/Programming/debug.h") && __has_include(<stdint.h>)
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define line 1
    #define d(...) 11
#endif

// Data Type ----------------------------------------------------------------

#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double

// Loops --------------------------------------------------------------------

#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)

// Stl ----------------------------------------------------------------------

#define pb                  push_back
#define pf                  push_front
#define eb                  emplace_back
#define popb                pop_back
#define popf                pop_front
#define mp                  make_pair
#define mt                  make_tuple
#define ff                  first
#define ss                  second
#define vll                 vector<ll>
#define vvl                 vector<vll>
#define pll                 pair<ll,ll>
#define mll                 map<ll,ll>
#define ub                  upper_bound
#define lb                  lower_bound
#define bs                  binary_search
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define get(tup,ind)        get<ind>(tup)

// Maths --------------------------------------------------------------------

const double PI = 2*acos(0.0);
#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a)/(__gcd((a),(b)))*(b))
#define log(x,b)            (log(x)/log(b))
#define INF                 LLONG_MAX

// Big data -----------------------------------------------------------------

const int Mod = 1E9 + 7;
#define Mul(a,b)            (((a) % Mod)*((b) % Mod)) % Mod
#define Sum(a,b)            (((a) % Mod)+((b) % Mod)) % Mod
#define Sub(a,b)            (((a) % Mod)-((b) % Mod) + Mod) % Mod
#define Div(a,b)            Mul(a,modInverse(b))

// Bit-Manipulation ---------------------------------------------------------

#define setbit(n,pos)       n |= (1LL<<pos)
#define resetbit(n,pos)     n &= (~(1LL<<pos))
#define toogle(n,pos)       n ^= (1LL<<pos)
#define atpos(n,pos)        ((n&(1LL<<pos))!=0)
#define bits(n)             (floor(log2(n)) + 1)
#define firstone(n)         (__builtin_ffs(n)-1)
#define countone(n)         (__builtin_popcount(n))

// Extra --------------------------------------------------------------------

#define fast                ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define scan(any)           for(auto &i:any) cin>>i;
#define print(any)          {for(auto &i:any) cout<<i<<" "; nl;}
#define printp(any)         for(auto &i:any) cout<<i.ff<<" "<<i.ss<<endl;
inline void yes()           {std::cout<<"Yes\n";}
inline void no()            {std::cout<<"No\n";}
#define flush               std::cout.flush()
#define nl                  std::cout<<'\n'
#define endl                '\n'

// Template -----------------------------------------------------------------

template<typename T,typename U>
inline bool exist(T val,U &any) {
    return any.find(val)!=any.end();
}
// multiple input
template<typename TAIL>
inline void inp(TAIL &T) {
    cin>>T;
}
template<typename HEAD,typename... TAIL>
inline void inp(HEAD &H,TAIL &...T) {
    cin>>H;
    inp(T...);
}
// scan pair
template<typename T,typename U>
inline istream& operator >>(istream &in,pair<T,U> &a) {
    in>>a.ff>>a.ss;
    return in;
}
// scan vertor
template<typename T>
inline istream& operator >>(istream &in,vector<T> &a) {
    for(auto &x : a) in>>x;
    return in;
}

// Solve --------------------------------------------------------------------

void solve(int &T)
{
    vvl a(3);
    loop(i,0,3) a[i].resize(3);
    std::cin>>a;

    ll n;
    std::cin>>n;
    vll f(101);    
    loop(i,0,n)
    {
        ll x;
        std::cin>>x;
        f[x]++;
    }

    loop(i,0,3)
    {
        ll x = a[i][0];
        ll y = a[i][1];
        ll z = a[i][2];
        f[x]--,f[y]--,f[z]--;
        if(f[x]>=0 and f[y]>=0 and f[z]>=0)
        {
            yes();
            return;
        }
        f[x]++,f[y]++,f[z]++;
    }

    loop(i,0,3)
    {
        ll x = a[0][i];
        ll y = a[1][i];
        ll z = a[2][i];
        f[x]--,f[y]--,f[z]--;
        if(f[x]>=0 and f[y]>=0 and f[z]>=0)
        {
            yes();
            return;
        }
        f[x]++,f[y]++,f[z]++;
    }

    {
        ll x = a[1][1];
        ll y = a[0][0];
        ll z = a[2][2];
        f[x]--,f[y]--,f[z]--;
        if(f[x]>=0 and f[y]>=0 and f[z]>=0)
        {
            yes();
            return;
        }
        f[x]++,f[y]++,f[z]++;
    }

    {
        ll x = a[1][1];
        ll y = a[0][2];
        ll z = a[2][0];
        f[x]--,f[y]--,f[z]--;
        if(f[x]>=0 and f[y]>=0 and f[z]>=0)
        {
            yes();
            return;
        }
        f[x]++,f[y]++,f[z]++;

    }    
    no();
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif
    
    fast;
    int t = 1;
    while(t--)
    solve(t);
    return 0;
}

Measured memory_bytes: 256