#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[10][10];
  int n, b[1000];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    for (int ii = 0; ii < 3; ii++) {
      for (int j = 0; j < 3; j++) {
        if (b[i] == a[ii][j]) a[ii][j] = 0;
      }
    }
  }
  bool ans = false;
  for (int i = 0; i < 3; i++) {
    if (!a[0][i] && !a[1][i] && !a[1][i]) ans = true;
    if (!a[i][0] && !a[i][1] && !a[i][2]) ans = true;
  }
  if (!a[0][0] && !a[1][1] && !a[2][2] || !a[0][2] && !a[1][1] && !a[2][0])
    ans = true;
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
