#include "bits/stdc++.h"

using namespace std;



int main(){

	int a[9];
	int n,b;
	for (auto& x : a) cin >> x;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> b;
		for (auto& x : a) {
			if (x == b) x = 0;
		}
	}

	if (a[0] + a[1] + a[2] == 0 || a[3] + a[4] + a[5] == 0 || a[6] + a[7] + a[8] == 0 ||
		a[0] + a[3] + a[6] == 0 || a[1] + a[4] + a[7] == 0 || a[2] + a[5] + a[8] == 0 ||
		a[0] + a[4] + a[8] == 0 || a[6] + a[4] + a[2] == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	

	cin >> n;
	return 0;

	
}

