#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

vector<vector<int>> a(3, vector<int>(3));
map<int, bool> mp;

int main() {
	rep(i, 3)rep(j, 3) cin >> a[i][j];
	int n; cin >> n;
	rep(i, n) {
		int b; cin >> b;
		mp[b] = true;
	}
	bool elf = false;
	rep(i, 3)if (mp[a[i][0]] && mp[a[i][1]] && mp[a[i][2]])elf = true;
	rep(i, 3)if (mp[a[0][i]] && mp[a[1][i]] && mp[a[2][i]]) elf = true;
	if (mp[a[0][0]] && mp[a[1][1]] && mp[a[2][2]]) elf = true;
	if (mp[a[0][2]] && mp[a[1][1]] && mp[a[2][0]]) elf = true;
	cout << (elf ? "Yes" : "No") << endl;
	return 0;
}
