#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

int main() {
    int A[3][3], N, b;
    rep(i, 3) rep(j, 3) cin >> A[i][j];
    cin >> N;
   vector<vector<bool>> c(3, vector<bool>(3, false));
    rep(i, N) {
        cin >> b;
        rep(j, 3) rep(k, 3) if (A[j][k] == b) c[j][k] = true;
    }
    string ans = "No\n";
    if (c[0][0] && c[1][1] && c[2][2]) ans = "Yes\n";
    if (c[0][2] && c[1][1] && c[2][0]) ans = "Yes\n";
    rep(i, 3) {
        if (c[i][0] && c[i][1] && c[i][2]) ans = "Yes\n";
        if (c[0][i] && c[1][i] && c[2][i]) ans = "Yes\n";
    }
    cout << ans;
}