#include <iostream>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <numeric>

using namespace std;

const double eps = 1e-7;
const int MOD = 1000000007;
const int MOD_MAX = 200000;

using ll = long long;
using vi = vector<int>; using vi2 = vector<vi>; using vi3 = vector<vi2>;
using vll = vector<ll>; using vll2 = vector<vll>; using vll3 = vector<vll2>;
using vd = vector<double>; using vd2 = vector<vd>; using vd3 = vector<vd2>;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vpi = vector<pi>; using vpll = vector<pll>;
using vstr = vector<string>;
using mapsi = map<string, int>;

#define loopi(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define loop(i, n) for (int i = 0; i < (int)n; i++)
#define loopeq(i, n) for (int i = 0; i <= (int)n; i++)
#define loopll(i, n) for (ll i = 0; i < (ll)n; i++)
#define looplleq(i, n) for (ll i = 0; i <= (ll)n; i++)
#define rloopi(i, a, b) for(int i = (int)a - 1; i >= (int)b; i--)
#define rloop(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define rloopeq(i, n) for (int i = (int)n - 1; i >= 1; i--)
#define rloopll(i, n) for (int i = (ll)n - 1; i >= 0; i--)
#define rlooplleq(i, n) for (int i = (ll)n - 1; i >= 1; i--)
#define all(a) (a).begin(), (a).end()

bool feq(float x, float y) { return abs(x-y) <= eps; }
bool deq(double x, double y) { return abs(x-y) <= eps; }
int ceillog2(ll x) { return int (ceil(log2(x))); }
int floorlog2(ll x) { return int (floor(log2(x))); }
template<class T> T reversed (T container) { reverse(container.begin(), container.end()); return container; }
template<class T> T sort (T container) { sort(container.begin(), container.end()); return container; }
ll gcd(ll m, ll n) { if (n == 0) return m; else return gcd(n, m % n); }
ll lcm(ll m, ll n) { return m * n / gcd(m, n); }

ll modinv(ll a) { ll b = MOD, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= MOD; if (u < 0) u += MOD; return u; }
ll modadd(ll a, ll b) { return ((a % MOD) + (b % MOD)) % MOD; }
ll modmult(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll modsub(ll a, ll b) { ll c = a % MOD - b % MOD; if (c < 0) return c + MOD; else return c;}
ll moddiv(ll a, ll b) { return (a % MOD * modinv(b % MOD)) % MOD; }
ll modpow(ll a, ll n) { ll ret = 1ll; while (n > 0) {  if (n & 1) ret = modmult(ret, a); a = modmult(a, a); n >>= 1; } return ret; }
ll modcomb(ll n, ll r) { if (n < r || n < 0 || r < 0) return 0; ll ret = 1; if (r > n / 2) r = n - r; loop(i, r) ret = modmult(ret, n-i); loop(i, r) ret = moddiv(ret, i+1); return ret; }
ll modhcomb(ll n, ll r) { return modcomb(n + r - 1, r); }

ll fact_arr[MOD_MAX + 10], finv_arr[MOD_MAX + 10], inv_arr[MOD_MAX + 10];
void modcomb_init() { fact_arr[0] = fact_arr[1] = 1; finv_arr[0] = finv_arr[1] = 1; inv_arr[1] = 1; for (int i = 2; i < MOD_MAX + 10; i++) { fact_arr[i] = fact_arr[i - 1] * i % MOD; inv_arr[i] = MOD - inv_arr[MOD%i] * (MOD / i) % MOD; finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % MOD; } }
ll modcomb_fast(ll n, ll r) { if (n < r || n < 0 || r < 0) return 0; return fact_arr[n] * (finv_arr[r] * finv_arr[n - r] % MOD) % MOD; }
ll modhcomb_fast(ll n, ll r) { return modcomb_fast(n + r - 1, r); }

ll fact_arr2[MOD_MAX + 10], finv_arr2[MOD_MAX + 10];
void modcomb_init2() { fact_arr2[0] = 1; loop(i, MOD_MAX + 10) fact_arr2[i + 1] = (i + 1) * fact_arr2[i] % MOD; loop(i, MOD_MAX + 10) finv_arr2[i] = modpow(fact_arr2[i], MOD - 2); }
ll modcomb_fast2(ll n, ll r) { if ( n < r || n < 0 || r < 0) return 0;  return fact_arr2[n] * finv_arr2[r] % MOD * finv_arr2[n - r] % MOD; }
ll modhcomb_fast2(ll n, ll r) { return modcomb_fast2(n + r - 1, r); }

bool check(vi2 a, vi b, int n) {
	loop(i, n) {
		loop(j, 3) {
			loop(k, 3) {
				if (b[i] == a[j][k]) a[j][k] = -1;
			}
		}
	}
	loop(i, 3) {
		if (a[i][0] == -1 && a[i][1] == -1 && a[i][2] == -1) return true;
	}
	loop(i, 3) {
		if (a[0][i] == -1 && a[1][i] == -1 && a[2][i] == -1) return true;
	}
	if (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) return true;
	if (a[0][2] == -1 && a[1][1] == -1 && a[0][2] == -1) return true;
	return false;
}

int main() {
	vi2 a(3, vi(3, 0));
	loop (i, 3) loop (j, 3) cin >> a[i][j];
	int n; cin >> n;
	vi b(n, 0); loop (i, n) cin >> b[i];
	if (check(a, b, n)) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256