// Slower C++ solution:
#include<iostream>

#include <string.h>

#include<string>

#include <map> 

#include <utility> 





using namespace std;



int main()

{

	/*long long h, a, attacks = 0;

	cin >> h >> a;

	while (h > 0)

	{

	attacks++;

	h -= a;

	}

	cout << attacks << endl;*/

	/*long long n;

	string s;

	cin >> n;

	getline(cin, s);

	getline(cin, s);

	char currentchar = s[0];

	int cnt = 1;



	for (int i = 1; i < s.size(); i++)

	{

	if (s[i] != currentchar)

	{

	currentchar = s[i];

	cnt++;

	}

	}



	cout << cnt << endl;*/



	/*int a, b, c;

	cin >> a >> b >> c;

	if ((a == b && a != c) || (a == c && a!=b) || (b == c && b!=a))

	cout << "Yes" << endl;

	else

	cout << "No" << endl;*/



	/*string S;

	getline(cin, S);

	//getline(cin, S);

	bool StingEnd = false;



	while (true)

	{

	int i;

	if (S.empty())

	break;

	for (i = 0; i < S.size()-1; i++)

	{



	if (S[i] == 'S' && S[i + 1] == 'T')

	{

	S.erase(i, 2);

	if (S.empty())

	break;

	//break;

	}

	}

	if (i == S.size()-1)

	break;

	}

	cout << S.size() << endl;*/



	/*int N, occurrence = 0;

	char S[100];

	cin >> N;

	cin >> S;

	for (int i = 0; i<N - 2; i++)

	{

		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')

			occurrence++;

	}

	cout << occurrence << endl;*/

	

	int Bingo[3][3];

	bool Exist[3][3];

	map <int, pair<int, int>> places;

	for (int i=0;i<3;i++)

	{

		for (int j=0;j<3;j++)

		{

			cin>>Bingo[i][j];

			Exist[i][j] =false;

			pair<int, int> current;

			current.first = i;

			current.second = j;

			places[Bingo[i][j]] = current;

			

			//places.insert(pair<int, pair>(Bingo[i][j], current)); 

		}

	}

	int N,B;

	cin>>N;

	for (int i=0;i<N;i++)

	{

		cin >>B;

		map<int, pair<int,int>>::iterator it = places.find(B);

		if ( it != places.end() ) 

			// not found

			{

				//pair<int, int> place= places.find(B);

				Exist[it->second.first][it->second.second] = true;

			}

	}

	

	bool IsBingo = false;

	

	if (Exist[0][0]&&Exist[0][1]&&Exist[0][2])

		IsBingo = true;

	else if(Exist[1][0]&&Exist[1][1]&&Exist[1][2])

		IsBingo = true;

	else if(Exist[2][0]&&Exist[2][1]&&Exist[2][2])

		IsBingo = true;

	else if(Exist[0][0]&&Exist[1][0]&&Exist[2][0])

		IsBingo = true;

else if(Exist[0][1]&&Exist[1][1]&&Exist[2][1])

		IsBingo = true;

else if(Exist[0][2]&&Exist[1][2]&&Exist[2][2])

		IsBingo = true;

else if(Exist[0][0]&&Exist[1][1]&&Exist[2][2])

		IsBingo = true;

else if(Exist[0][2]&&Exist[1][1]&&Exist[2][0])

		IsBingo = true;



	

	if (IsBingo)

		cout<< "Yes"<<endl;

	else

		cout<<"No" <<endl;

	



	//system("pause");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.238146258233488x):
#include <stdio.h>



int main(){

    int matrix[3][3];

    char x;

    for(int i=0;i<3;i++){

        for(int j=0;j<3;j++){

            scanf("%d", &matrix[i][j]);

        }

    }

    int n;

    scanf("%d",&n);

    int input[n];

    for(int k=0;k<n;k++){

        scanf("%d", &input[k]);

        for(int i=0;i<3;i++){

            for(int j=0;j<3;j++){

                if(input[k] == matrix[i][j]){

                    matrix[i][j] = x;

                }

            }

        }

    }

    int ctr[8] = {0};

    int last=2;

    for(int i=0;i<3;i++){

        if(matrix[i][0]==x){

            ++ctr[0];

        }

        if(matrix[i][2]==x){

            ++ctr[1];

        }

        if(matrix[0][i]==x){

            ++ctr[2];

        }

        if(matrix[2][i]==x){

            ++ctr[3];

        }

        if(matrix[i][i]==x){

            ++ctr[4];

        } 

        if(matrix[i][last--]==x){

            ++ctr[5];

        }

        if(matrix[1][i]==x){

            ++ctr[6];

        }

        if(matrix[i][1]==x){

            ++ctr[7];

        }

    }

    int flag = 0;

    for(int i=0;i<8;i++){

        if(ctr[i]==3){

            flag = 1;

        }

    }

    printf("%s\n", (flag == 1) ? "Yes" : "No");



    return 0;

}