#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  cin >> n;
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  int cur[3][3];
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (a[i][j] == b[k]) cur[i][j] = 1;
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cout << cur[i][j] << "\n";
    }
  }
  int ans = 0;
  if (cur[0][0] == 1 && cur[0][1] == 1 && cur[0][2] == 1) ans++;
  if (cur[1][0] == 1 && cur[1][1] == 1 && cur[1][2] == 1) ans++;
  if (cur[2][0] == 1 && cur[2][1] == 1 && cur[2][2] == 1) ans++;
  if (cur[0][0] == 1 && cur[1][1] == 1 && cur[2][2] == 1) ans++;
  if (cur[0][0] == 1 && cur[1][0] == 1 && cur[2][0] == 1) ans++;
  if (cur[0][1] == 1 && cur[1][1] == 1 && cur[2][1] == 1) ans++;
  if (cur[0][2] == 1 && cur[1][2] == 1 && cur[2][2] == 1) ans++;
  if (cur[0][2] == 1 && cur[1][1] == 1 && cur[2][0] == 1) ans++;
  if (ans >= 1)
    cout << "Yes"
         << "\n";
  else
    cout << "No"
         << "\n";
}
