#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {1, -1, 1, 0, -1, 0, 1, -1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long a[4][4];
long long mark[200];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j, x, y, n;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) cin >> a[i][j];
  }
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    mark[x] = 1;
  }
  x = a[0][0], y = a[1][1];
  long long x1 = a[2][2];
  if (mark[x] == mark[x1] == mark[y] && mark[x] == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  x = a[0][2], y = a[1][1], x1 = a[2][0];
  if (mark[x] + mark[y] + mark[x1] == 3) {
    cout << "Yes" << endl;
  } else {
    bool f = 0;
    for (i = 0; i < 3; i++) {
      long long cn = 0, cn1 = 0;
      for (j = 0; j < 3; j++) {
        cn += mark[a[i][j]];
        cn1 += mark[a[j][i]];
      }
      if (cn == 3 || cn1 == 3) f = 1;
    }
    if (f)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
