#include <bits/stdc++.h>
using namespace std;
int main() {
  int m[3][3];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> m[i][j];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (m[i][j] == x) m[i][j] = -1;
      }
    }
  }
  if ((m[0][0] == -1 && m[1][0] == -1 && m[2][0] == -1) ||
      (m[0][1] == -1 && m[1][1] == -1 && m[2][1] == -1) ||
      (m[0][2] == -1 && m[1][2] == -1 && m[2][2] == -1) ||
      (m[0][0] == -1 && m[0][1] == -1 && m[0][2] == -1) ||
      (m[1][0] == -1 && m[1][1] == -1 && m[1][2] == -1) ||
      (m[2][0] == -1 && m[2][1] == -1 && m[2][2] == -1) ||
      (m[0][0] == -1 && m[1][1] == -1 && m[2][2] == -1) ||
      (m[0][2] == -1 && m[1][1] == -1 && m[2][0] == -1))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
