#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int A[9], N;
    bool X[9] = {false};
    for(int i = 0; i < 9; ++i) cin >> A[i];
    cin >> N;
    
    int b[N];
    for(int i = 0; i < N; ++i) cin >> b[i];

    for(int i = 0; i < 9; ++i){
        for(int j = 0; j < N; ++j){
            if(A[i] == b[j]) X[i] = true;
        }
    }
    if(X[0]&&X[1]&&X[2] ||X[3]&&X[4]&&X[5]
     ||X[6]&&X[7]&&X[8] ||X[0]&&X[3]&&X[6]
     ||X[1]&&X[4]&&X[7] ||X[2]&&X[5]&&X[8]
     ||X[0]&&X[4]&&X[8]||X[2]&&X[4]&&X[6])
      
      cout << "Yes" << endl;
    else cout << "No" << endl;
}
