/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
		
const double eps = 1e-9;																							   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////

int n;
int tab[4][4];
int tab2[4][4];
set<int> SET;

///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	cin >> tab[0][0];
	cin >> tab[0][1];
	cin >> tab[0][2];
	cin >> tab[1][0];
	cin >> tab[1][1];
	cin >> tab[1][2];
	cin >> tab[2][0];
	cin >> tab[2][1];
	cin >> tab[2][2];
	
	tab2[0][0] = tab[0][0];
	tab2[0][1] = tab[1][0];
	tab2[0][2] = tab[2][0];
	tab2[1][0] = tab[0][1];
	tab2[1][1] = tab[1][1];
	tab2[1][2] = tab[2][1];
	tab2[2][0] = tab[0][2];
	tab2[2][1] = tab[1][2];
	tab2[2][2] = tab[2][2];
	
	cin >> n;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		SET.insert(x);
	}
	
	bool confirm = false;
	
	auto it = SET.find(tab[0][0]);
	auto it2 = SET.find(tab[0][1]);
	auto it3 = SET.find(tab[0][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab[1][0]);
	it2 = SET.find(tab[1][1]);
	it3 = SET.find(tab[1][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab[2][0]);
	it2 = SET.find(tab[2][1]);
	it3 = SET.find(tab[2][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab2[0][0]);
	it2 = SET.find(tab2[0][1]);
	it3 = SET.find(tab2[0][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab2[1][0]);
	it2 = SET.find(tab2[1][1]);
	it3 = SET.find(tab2[1][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab2[2][0]);
	it2 = SET.find(tab2[2][1]);
	it3 = SET.find(tab2[2][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab[0][0]);
	it2 = SET.find(tab[1][1]);
	it3 = SET.find(tab[2][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	it = SET.find(tab[2][0]);
	it2 = SET.find(tab[1][1]);
	it3 = SET.find(tab[0][2]);
	
	if(it != SET.end() && it2 != SET.end() && it3 != SET.end()){
		confirm = true;
	}
	
	if(confirm) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	
	
	
	return 0;
	
}


Measured memory_bytes: 256