#pragma region template

#include <bits/stdc++.h>

using namespace std;

// -type-
using str = string;
using ll = int64_t;
using pii = pair<int64_t, int64_t>;
using pis = pair<int64_t, str>;
using psi = pair<str, int64_t>;
using vi = vector<int64_t>;
using vvi = vector<vector<int64_t>>;
using vs = vector<str>;
using vpii = vector<pair<int64_t, int64_t>>;


//--const
constexpr ll MOD = 1000000007;
const string YES = "Yes";
const string NO = "No";

constexpr int INFI = int(0x3f000000);
constexpr ll INF = ll(0x3f0000003f000000);
constexpr double EPS = 1e-9;
constexpr int dx[] = {0, 1, 0, -1, 1, -1, 1, -1},
              dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


// clang-format off
//--define
#define _overload3(_1, _2, _3, name, ...) name
#define   rep(...) _overload3(__VA_ARGS__,  _rep3,  _rep2,)(__VA_ARGS__)
#define  repc(...) _overload3(__VA_ARGS__, _repc3, _repc2,)(__VA_ARGS__)
#define  repr(...) _overload3(__VA_ARGS__, _repr3, _repr2,)(__VA_ARGS__)
#define repcr(...) _overload3(__VA_ARGS__,_repcr3,_repcr2,)(__VA_ARGS__)
#define _rep(i,k,n) for(int i=(k)   , i##_len=(n); i < i##_len; ++i)
#define   _rep2(i  ,n) _rep(i,0,n) 
#define   _rep3(i,k,n) _rep(i,k,n)
#define  _repc2(i  ,n) _rep(i,1,n+1)
#define  _repc3(i,k,n) _rep(i,k,n+1) 
#define _repr(i,k,n) for(int i=(n-1), i##_len=(k); i >=i##_len; --i)
#define  _repr2(i  ,n) _repr(i,0,n)
#define  _repr3(i,k,n) _repr(i,k,n) 
#define _repcr2(i  ,n) _repr(i,1,n+1)
#define _repcr3(i,k,n) _repr(i,k,n+1)
//rep-macro   normal, close, reverse, close+reverse

#define all(o) begin(o), end(o)
#define sz(a) ((int)(a).size())
#define debug(...) debug_args(__LINE__, __VA_ARGS__)
#define pow2(n) (1LL<<(n))


//--functions
inline bool in(string s, string c) {return (s.find(c) != string::npos);}
inline bool in(string s,   char c) {return (s.find(c) != string::npos);}

template <class T> T udiv(T a, T b) {return (a + b - 1) / b;}
template <class T> T rdiv(T a, T b) {return (a + b / 2) / b;}

void print_args(ostream&) {}
template <class S, class... T>
void print_args(ostream& out,const S& a,const T&... args) {
    out << ' ' << a;
    print_args(out, args...);
}
template <class S, class... T>
void print(const S& a, const T&... args) {
    std::cout << a;
    print_args(std::cout, args...);
    std::cout << '\n';
}
template <class S, class... T>
void debug_args(const S& a, const T&... args) {
    std::cout << "(L:" << std::setw(3) << a << ")";
    print_args(std::cout, args...);
    std::cout << '\n';
}
// clang-format on

struct setup_main {
    setup_main() {
        std::cin.tie(0);
        std::ios::sync_with_stdio(0);
        std::cout << fixed << setprecision(15);
    }
} setup_main_;

ll ans(0);
#pragma endregion

void solve(std::vector<std::vector<long long>> A,
           long long N,
           std::vector<long long> b) {
    vvi B(3, vi(3, false));
    for (auto&& p : b) {
        rep(i, 3) rep(j, 3) {
            if (p == A[i][j]) B[i][j] = true;
        }
    }
    if (B[0][0] and B[1][1] and B[2][2]) ans++;
    if (B[0][2] and B[1][1] and B[2][0]) ans++;
    rep(p, 3) {
        if (B[0][p] and B[1][p] and B[2][p]) ans++;
        if (B[p][0] and B[p][1] and B[p][2]) ans++;
    }
    if (ans != 0)
        print(YES);
    else
        print(NO);
    // print(ans);
}
signed main() {
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            scanf("%lld", &A[i][j]);
        }
    }
    long long N;
    scanf("%lld", &N);
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &b[i]);
    }
    solve(std::move(A), N, std::move(b));

    return 0;
}


Measured memory_bytes: 256