#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[3][3];
  for (long long int i = 0; i < 3; i++) {
    for (long long int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  long long int n;
  cin >> n;
  while (n--) {
    long long int x;
    cin >> x;
    for (long long int i = 0; i < 3; i++) {
      for (long long int j = 0; j < 3; j++) {
        if (a[i][j] == x) {
          a[i][j] = 0;
          break;
        }
      }
    }
  }
  long long int x = 0;
  for (long long int i = 0; i < 3; i++) {
    long long int h = 1;
    for (long long int j = 0; j < 3; j++) {
      if (a[i][j] != 0) {
        h = 0;
        break;
      }
    }
    if (h == 1) {
      x = 1;
      break;
    }
  }
  for (long long int i = 0; i < 3; i++) {
    long long int h1 = 1;
    for (long long int j = 0; j < 3; j++) {
      if (a[j][i] != 0) {
        h1 = 0;
        break;
      }
    }
    if (h1 == 1) {
      x = 1;
      break;
    }
  }
  if (a[0][0] == a[1][1] && ((a[1][1] == a[2][2]) && (a[2][2] == a[0][0])))
    x = 1;
  if (a[0][2] == a[1][1] && ((a[1][1] == a[2][0]) && (a[2][0] == a[0][2])))
    x = 1;
  if (x == 1)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
