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