#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a[3][3], b[10];
  bool appear[3][3];
  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 i = 0; i < (n); ++i) {
    for (int j = 0; j < (n); ++j) {
      appear[i][j] = false;
      for (int k = 0; k < (n); ++k) {
        if (a[i][j] == b[k]) {
          appear[i][j] = true;
        }
      }
    }
  }
  string ans = "No";
  for (int i = 0; i < (3); ++i) {
    if (appear[i][0] and appear[i][1] and appear[i][0]) {
      ans = "Yes";
    }
  }
  for (int i = 0; i < (3); ++i) {
    if (appear[0][i] and appear[1][i] and appear[2][i]) {
      ans = "Yes";
    }
  }
  if (appear[0][0] and appear[1][1] and appear[2][2]) {
    ans = "Yes";
  }
  if (appear[0][2] and appear[1][1] and appear[2][0]) {
    ans = "Yes";
  }
  cout << ans;
  return 0;
}
