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

#include <string.h>

int main(){

	

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

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

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

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

		}

	}

	int N;

	scanf("%d", &N);

	int numb[N]={0};

	

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

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

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

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

				if(numb[k] == arr[l][m]){

					arr[l][m] = 0;

				}

			}

		}

	}

	if(arr[0][0]==0 && arr[0][1]==0 && arr[0][2]==0){

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

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

		printf("Yes");

	} else {

		printf("No");	

	}

	

	return 0;

}