#include <iostream>

using namespace std;

int main() {
	int a[3][3], cnt[8] = {};
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j)
			cin >> a[i][j];
	int n; cin >> n;
	while (n--) {
		int b; cin >> b;
		for (int i = 0; i < 3; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (a[i][j] == b) {
					++cnt[i];
					++cnt[j + 3];
					if (i == j) ++cnt[6];
					if (i + j == 2) ++cnt[7];
				}
			}
		}
	}
	bool flag = false;
	for (int i = 0; i < 8; ++i)
		if (cnt[i] > 2) flag = true;
	cout << (flag ? "Yes" : "No") << endl;

	return 0;
}