#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> v(3, vector<int>(3));
  vector<vector<bool>> ch(3, vector<bool>(3));
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> v[i][j];
    }
  }
  int n;
  cin >> n;
  vector<int> val(n);
  for (int i = 0; i < n; ++i) {
    cin >> val[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (v[j][k] == val[i]) {
          ch[j][k] = 1;
        }
      }
    }
  }
  bool d = 0;
  for (int i = 0; i < 3; ++i) {
    bool a = 1;
    bool b = 1;
    for (int j = 0; j < 3; ++j) {
      if (ch[i][j] != 1) {
        a = 0;
      }
      if (ch[j][i] != 1) {
        b = 0;
      }
    }
    if (a || b) {
      d = 1;
    }
  }
  if (ch[0][0] == 1 && ch[1][1] == 1 && ch[2][2] == 1) {
    d = 1;
  }
  if (ch[2][0] == 1 && ch[1][1] == 1 && ch[0][2] == 1) {
    d = 1;
  }
  if (d) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}
