#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int a[10][10];
int n;
void solve() {
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cin >> a[i][j];
  }
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (a[i][j] == x) {
          a[i][j] = -1;
          break;
        }
      }
    }
  }
  bool ok = false;
  for (int i = 0; i < 3; i++) {
    bool f = false;
    for (int j = 0; j < 3; j++) {
      if (a[i][j] != -1) {
        f = true;
        break;
      }
    }
    if (!f) ok = true;
  }
  for (int i = 0; i < 3; i++) {
    bool f = false;
    for (int j = 0; j < 3; j++) {
      if (a[j][i] != -1) {
        f = true;
        break;
      }
    }
    if (!f) ok = true;
  }
  bool f = false;
  for (int i = 0; i < 3; i++) {
    if (a[i][i] != -1) {
      f = true;
      break;
    }
  }
  if (!f) ok = true;
  for (int i = 0; i < 3; i++) {
    if (a[i][n - i - 1] != -1) {
      f = true;
      break;
    }
  }
  if (!f) ok = true;
  cout << (ok ? "Yes" : "No");
}
int main() {
  ios::sync_with_stdio(false);
  int q = 1;
  for (int i = 1; i <= q; i++) {
    solve();
  }
}
