/*
Author: Fuadul Hasan(fuadul202@gmail.com)
BSMRSTU,Gopalganj
*/
#include<bits/stdc++.h>
using namespace std;

void    		print(int n)    {printf("%d ", n);}
void    		printl(long long n)     {printf("%I64d ", n);}
long long    	readline(){long long x;scanf("%I64d", &x);return x;}
/*
1.#define  gcd(a,b) __gcd(a,b) 2. #define  lcm(a,b) (a*b)/gcd(a,b) 3. #define  PI acos(-1.0) 4.#define  sqr(x) ((x)*(x))
5.#define  min3(a,b,c) min(a,min(b,c))6.#define  min4(a,b,c,d) min(d,min(a,min(b,c)))7.#define  max3(a,b,c) max(a,max(b,c))
8.#define  max4(a,b,c,d) max(d,max(a,max(b,c)))
*/
//.............ignore it................//
/*....... scanf.......*/
template <typename T> inline void readline(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';n = n * f;}
template <typename T, typename TT> inline void readline(T &n, TT &m) { readline(n); readline(m); }
template <typename T, typename TT, typename TTT> inline void readline(T &n, TT &m, TTT &l) { readline(n, m); readline(l);}
/*..........error........*/
#define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;}
vector<string> split(const string &s, char c) {
  vector<string>v; stringstream ss(s); string x;
  while (getline(ss, x, c))v.emplace_back(x); return move(v);
} void err(vector<string>::iterator it) {}
template<typename T, typename... Args>void err(vector<string>::iterator it, T a, Args...args) {
cout << it->substr((*it)[0] == ' ', it->length()) << " = " << a << " "; err(++it, args...);}
//............ignore it..................//

typedef  pair<int, int> ii;
typedef  std::vector<ii> vii;
#define  vi   std::vector<int>
#define  vll  std::vector<ll>
#define  all(n) n.begin(),n.end()
#define  mpsi std::map<string, int>
#define  pb    push_back
#define  ll    long long int
#define  nl    printf("\n");
#define  happy  cin.tie(0);
#define  coding ios::sync_with_stdio(false);

const int mod           = 1e9 + 7;
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)2e18 + 5;
const int N             = 1e6 + 5;
const int N1            = 3e5 + 5;

int siv[N1];
int solve()
{
	//happy coding
	int a[10];
	for(int i=0;i<9;i++){
		cin>>a[i];
	}
	int n;
	bool x1 = false,x2=false,x3=false;
	cin>>n;
	int b[1000];
	for(int i=0;i<n;i++){
		cin>>b[i];
		siv[b[i]]=1;
	}
	if(siv[a[0]]==1&&siv[a[4]]==1&&siv[a[8]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[2]]==1&&siv[a[4]]==1&&siv[a[6]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[0]]==1&&siv[a[3]]==1&&siv[a[6]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[1]]==1&&siv[a[4]]==1&&siv[a[7]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[2]]==1&&siv[a[5]]==1&&siv[a[8]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[0]]==1&&siv[a[1]]==1&&siv[a[2]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[3]]==1&&siv[a[4]]==1&&siv[a[5]]==1)
	{
		cout<<"Yes"<<endl;
	}else if(siv[a[6]]==1&&siv[a[7]]==1&&siv[a[8]]==1)
	{
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	//error()
	return 0;
}

int main(){
	int test = 1, tc = 0;
	//scanf("%d", &test);//(void)getchar();
	while (test--)solve();
	return 0;
}

Measured memory_bytes: 256