// 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.297972734570906x):
#include <stdio.h>



int main() {

    int bingos[3][3] = {0};

    bool bingos_mark[3][3] = {false};

    int ninp;

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

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

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

        }

    }

    scanf("%d", &ninp);

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

        int te;

        scanf("%d", &te);

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

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

                if (te == bingos[i][j]) {

                    bingos_mark[i][j] = true;

                }

            }

        }

    }



    if (bingos_mark[0][0] && bingos_mark[1][1] && bingos_mark[2][2]) {

        printf("Yes");

    } else if (bingos_mark[0][2] && bingos_mark[1][1] && bingos_mark[2][0]) {

        printf("Yes");

    } else if (bingos_mark[0][0] && bingos_mark[0][1] && bingos_mark[0][2]) {

        printf("Yes");

    } else if (bingos_mark[1][0] && bingos_mark[1][1] && bingos_mark[1][2]) {

        printf("Yes");

    } else if (bingos_mark[2][0] && bingos_mark[2][1] && bingos_mark[2][2]) {

        printf("Yes");

    } else if (bingos_mark[0][0] && bingos_mark[1][0] && bingos_mark[2][0]) {

        printf("Yes");

    } else if (bingos_mark[0][1] && bingos_mark[1][1] && bingos_mark[2][1]) {

        printf("Yes");

    } else if (bingos_mark[0][2] && bingos_mark[1][2] && bingos_mark[2][2]) {

        printf("Yes");

    } else {

        printf("No");

    }

}