#include <bits/stdc++.h>
using namespace std;
int ANS[3][3] = {};
bool check(int A[3][3], int x) {
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      if (x == A[i][j]) {
        ANS[i][j] = 1;
        return true;
      }
    }
  }
  return false;
}
int main() {
  int N;
  int A[3][3];
  vector<int> b;
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  cin >> N;
  for (i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    b.push_back(temp);
  }
  for (i = 0; i < N; i++) {
    check(A, b.at(i));
  }
  int sum1 = 0;
  int sum2 = 0;
  int sum3 = 0;
  int sum4 = 0;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      sum1 += ANS[i][j];
      sum2 += ANS[j][i];
    }
    if (sum1 == 3 || sum2 == 3) {
      cout << "Yes" << endl;
      return 0;
    }
    sum1 = 0;
    sum2 = 0;
  }
  for (i = 0; i < 3; i++) {
    sum3 += ANS[i][i];
  }
  for (i = 0; i < 3; i++) {
    sum4 += ANS[i][2 - i];
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cout << ANS[i][j] << " ";
    }
    cout << endl;
  }
  if (sum3 == 3 || sum4 == 3)
    cout << "Yes" << endl;
  else {
    cout << "No" << endl;
  }
  return 0;
}
