#include <iostream>
using namespace std;
int bingo[30][30];
bool bbingo[3][3];
int number[100];
int main(){
    int total;
    for(int i=0;i<=3;i++){
        for(int j=0;j<=3;j++){
            cin >> bingo[i][j];
        }
    }
    cin >> total;
    for(int a = 0;a <= total;i++){
        cin >> number[a];
    }
    for(int i=0;i<=3;i++){
        for(int j=0;j<=3;j++){
            for(int a = 0;a <= total;a++){
                if(bingo[i][j] == number[a]){
                    bbingo[i][j] = true;
                }
            }
        }
    }
    if(){
        for(int i=0;i<=3;i++){
            if(bbingo[i][1]==bbingo[i][2] && bbingo[i][1]==bbingo[i][3]){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    else if(){
        for(int j=0;j<=3;j++){
            if(bbingo[1][j]==bbingo[2][j] && bbingo[1][j]==bbingo[3][j]){
                cout << "Yes" << endl;
                return 0;
            }   
        }
    }
    else if (bbingo[1][1]==bbingo[2][2] && bbingo[1][1]==bbingo[3][3]){
        cout << "Yes" << endl;
        return 0;
    }
    else if(bbingo[1][3]==bbingo[2][2] && bbingo[1][3]==bbingo[3][1]){
        cout << "Yes" << endl;
        return 0;
    }
    else {
        cout << "No" << endl;
        return 0;
    }
}
