#include <bits/stdc++.h>
using namespace std;

int a[9];
bool bingo[9];

int direction[8][3] = {
	{0, 1, 2},
	{3, 4, 5},
	{6, 7, 8},
	{0, 3, 6},
	{1, 4, 7},
	{2, 5, 8},
	{0, 4, 8},
	{2, 4, 6},
};

int main(){
	for(int i = 0; i < 9; i++)
		scanf("%d", &a[i]);
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		for(int j = 0; j < 9; j++)
			if(a[j] == x) bingo[j] = true;
	}
	for(int i = 0; i < 8; i++) {
		if(bingo[direction[i][0]] && bingo[direction[i][1]] && bingo[direction[i][2]]) {
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
}
