#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int largest(int a, int b) { return (a < b) ? b : a; }
int main() {
  int grid[3][3];
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> grid[i][j];
    }
  }
  int n = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (a[k] == grid[i][j]) {
          grid[i][j] = -1;
        }
      }
    }
  }
  for (int i = 0; i < 3; ++i) {
    int cnt = 0, cnt1 = 0;
    for (int j = 0; j < 3; ++j) {
      if (grid[i][j] == -1) {
        ++cnt;
      }
      if (grid[j][i] == -1) {
        ++cnt1;
      }
    }
    if (cnt == 3 or cnt1 == 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (grid[0][0] == -1 and grid[1][1] == -1 and grid[2][2] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (grid[0][2] == -1 and grid[1][1] == -1 and grid[2][0] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
