#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3];
  bool b[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
      b[i][j] = false;
    }
  }
  int N;
  cin >> N;
  for (int k = 0; k < N; k++) {
    int c;
    cin >> c;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (c == a[i][j]) b[i][j] = true;
      }
    }
  }
  bool isYes = false;
  for (int i = 0; i < 3; i++) {
    if (b[i][0] == true && b[i][1] == true && b[i][2] == true) isYes = true;
  }
  if (b[0][0] == true && b[1][1] == true && b[2][2] == true) isYes = true;
  for (int i = 0; i < 3; i++) {
    if (b[0][i] == true && b[1][i] == true && b[2][i] == true) isYes = true;
  }
  if (b[2][0] == true && b[1][1] == true && b[0][2] == true) isYes = true;
  if (isYes) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
