// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

    int N, G[10];

    int a[3][3], ck[3][3];

 

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

        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);

    }



    scanf("%d",&N);



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

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

 

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

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

                if( G[j] == a[x][z] ) {

                    ck[x][z] = 1;

                }

            }

        }

    }



    if( (ck[1][1] == 1 && ck[2][2] == 1 && ck[0][0] == 1  )

    ||(ck[2][0] == 1 && ck[1][1] == 1 && ck[0][2] == 1  )

    ||(ck[0][0] == 1 && ck[0][1] == 1 && ck[0][2] == 1  )

    ||(ck[1][0] == 1 && ck[1][1] == 1 && ck[1][2] == 1  )

    ||(ck[2][0] == 1 && ck[2][1] == 1 && ck[2][2] == 1  )

    ||(ck[0][0] == 1 && ck[1][0] == 1 && ck[2][0] == 1  )

    ||(ck[0][1] == 1 && ck[1][1] == 1 && ck[2][1] == 1  )

    || (ck[0][2] == 1 && ck[1][2] == 1 && ck[2][2] == 1  )

    ) {

        printf("Yes\n");

    } else {

        printf("No\n");

    }





    return 0;

}

// Fastest known solution for this problem: