#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int a[3][3];
int b[114];
int n;
int c[3][3];
signed main() {
	rep(i, 3) {
		rep(j, 3)cin >> a[i][j];
	}
	cin >> n;
	rep(i, n)cin >> b[i];
	rep(i, n) {
		rep(j, 3) {
			rep(k, 3) {
				if (b[i] == a[j][k])c[j][k] = 1;
			}
		}
	}
	if (c[0][0] == 1 && c[0][1] == 1 && c[0][2] == 1) {
		puts("Yes");
		ggr
	}
	if (c[1][0] == 1 && c[1][1] == 1 && c[1][2] == 1) {
		puts("Yes");
		ggr
	}
	if (c[2][0] == 1 && c[2][1] == 1 && c[2][2] == 1) {
		puts("Yes");
		ggr
	}
	if (c[0][0] == 1 && c[1][0] == 1 && c[2][0] == 1) {
		puts("Yes");
		ggr
	}
	if (c[0][1] == 1 && c[1][1] == 1 && c[2][1] == 1) {
		puts("Yes");
		ggr
	}
	if (c[0][2] == 1 && c[1][2] == 1 && c[2][2] == 1) {
		puts("Yes");
		ggr
	}
	if (c[0][0] == 1 && c[1][1] == 1 && c[2][2] == 1) {
		puts("Yes");
		ggr
	}
	if (c[0][2] == 1 && c[1][1] == 1 && c[2][0] == 1) {
		puts("Yes");
		ggr
	}
	puts("No");
	ggr
}


Measured memory_bytes: 256