#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x, ara[10][10], i, j;
  for (i = 1; i <= 3; i++) {
    for (j = 1; j <= 3; j++) cin >> ara[i][j];
  }
  cin >> q;
  for (int que = 1; que <= q; que++) {
    cin >> x;
    int flag = 0;
    for (i = 1; i <= 3; i++) {
      for (j = 1; j <= 3; j++) {
        if (ara[i][j] == x) {
          ara[i][j] = -1;
          flag = 1;
          break;
        }
      }
      if (flag) break;
    }
  }
  int k = 1, l = 3;
  int flag2 = 0, flag3 = 0, flag1 = 0, flag4 = 0;
  for (i = 1; i <= 3; i++) {
    flag1 = flag4 = 0;
    for (j = 1; j <= 3; j++) {
      if (ara[i][j] != -1) {
        flag1 = 1;
      }
      if (ara[j][i] != -1) {
        flag4 = 1;
      }
    }
    if (flag1 == 0 || flag4 == 0) break;
    if (ara[k][k] != -1) {
      flag2 = 1;
    }
    if (ara[l][l] != -1) {
      flag3 = 1;
    }
    k++;
    l--;
  }
  if (flag1 == 0 || flag2 == 0 || flag3 == 0 || flag4 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
